Skip to content

Instantly share code, notes, and snippets.

@giljr
Last active March 7, 2018 20:51
Show Gist options
  • Save giljr/752cf46f80b17025d8354c56e71b17a2 to your computer and use it in GitHub Desktop.
Save giljr/752cf46f80b17025d8354c56e71b17a2 to your computer and use it in GitHub Desktop.
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