Exemple #1
0
            public GameObject shot()
            {
                GameObject  bullet_obj = instanciate_bullet();
                Bullet_base bullet     = bullet_obj.GetComponent <Bullet_base>();

                bullet.shot(direction_shot);
                return(bullet_obj);
            }
 public void GetDamage(Bullet_base B)
 {
     Debug.Log("GetHit!! " + this.HP);
     this.HP -= B.Damage;
     if (this.HP <= 0)
     {
         //Dead
         this.gameObject.SetActive(false);
     }
 }
Exemple #3
0
            public IEnumerator shot_should_set_the_velocity()
            {
                Bullet_base bullet_instance = bullet.GetComponent <Bullet_base>();

                bullet_instance.shot(bullet.transform.forward);
                Rigidbody bullet_rigidbody = bullet.GetComponent <Rigidbody>();

                yield return(new WaitForSeconds(1));

                Debug.Log(bullet_rigidbody);
                Assert.AreEqual(
                    bullet_instance.max_speed * bullet.transform.forward,
                    bullet_rigidbody.velocity);
            }