private void Shoot() { RedBullet newBullet = Instantiate(bullet, this.transform.position + new Vector3(1.0f, 0, 0), bullet.transform.rotation); newBullet.parent = gameObject; newBullet.Fire(); }
/// <summary> /// OnTriggerEnter Unity Method /// Usable when DoorCell is get by an entity that deals damages. /// </summary> /// <param name="other">The entity that touch the DoorCell</param> private void OnTriggerEnter(Collider other) { if (other.GetComponent <RedBullet>()) { RedBullet bullet = other.GetComponent <RedBullet>(); doorHealth -= bullet.damage; } }
private void CheckForShooting() { if (shootingCooldown <= 0) { var b = new RedBullet(position); (b as RedBullet).SetTexture(); bullets.Add(b); shootingCooldown = initialShootingCooldown; } else { shootingCooldown -= GameManager.DeltaTime;; } }
/// <summary> /// TakeDamage method. /// Usable when RedEnemy is get by an entity that deals damages. /// </summary> /// <param name="damage">The number of damage you want to Apply</param> /// <param name="bullet">The RedBullet that touch the RedEnemy</param> public void TakeDamage(int damage, RedBullet bullet) { if (bullet.type == type) { hp -= damage; } else { Debug.Log("Immune Asooooo"); } if (hp <= 0) { BeKilled(); } }
void Start() { bullet = Resources.Load <RedBullet>("RedBullet"); }
// Start is called before the first frame update void Start() { redBullet = gameObject.AddComponent <RedBullet>(); blueBullet = gameObject.AddComponent <BlueBullet>(); gameManager = GameObject.Find("GameManager").GetComponent <GameManager>(); }