Last active
August 27, 2019 14:23
-
-
Save IRobS/7a62ea5c4f6219e7a66547983ffeec50 to your computer and use it in GitHub Desktop.
Damage Player - this requires that the player has a PlayerLife script with the ability to "takeDamage"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Damage Player - this requires that the player has a PlayerLife script with the ability to "takeDamage" | |
*/ | |
background: #d67; | |
min-height: 100%; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<pre> | |
<code> | |
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class DamagePlayer : MonoBehaviour | |
{ | |
void OnCollisionEnter(Collision collision) | |
{ | |
PlayerLife thePlayer = collision.collider.GetComponent<PlayerLife>(); | |
if (thePlayer != null) | |
{ | |
thePlayer.takeDamage(); | |
} | |
} | |
} | |
</code> | |
</pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// alert('Hello world!'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"all"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment