Last active
March 7, 2018 20:51
-
-
Save giljr/752cf46f80b17025d8354c56e71b17a2 to your computer and use it in GitHub Desktop.
Episode #10 Unity Game https://medium.com/@J.3/unity-33963a5ca3d3
This file contains hidden or 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
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class ShootHandler : MonoBehaviour { | |
private AudioSource mAudioSrc; | |
public void Start() | |
{ | |
mAudioSrc = GetComponent<AudioSource>(); | |
} | |
public void ShootEvent() | |
{ | |
int doShoot = Random.Range(0, 2); | |
if (doShoot > 0) | |
{ | |
mAudioSrc.Play(); | |
//int damage = Random.Range(0, 6); | |
//increase the damage value so that the health value | |
//of the player will come down to zero faster | |
int damage = Random.Range(0, 30); | |
//we must add a random logic to set damage | |
//GameController.Instance.SetDamage(10); | |
GameController.Instance.SetDamage(damage); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment