예제 #1
0
 // 戻り値 True:Destroyed False:Alive
 public virtual bool HitToShot(ShotBase shot)
 {
     unitLife -= shot.Power;
     _renderer.material.SetColor("_EmissionColor", new Color(0.2f, 0.2f, 0.1f));
     luminousTime = 2;
     if (ComplexLife <= 0)
     {
         //Destroy(Instantiate(explodeFx, transform.position, Quaternion.identity), 10);
         foreach (Transform e in transform)
         {
             if (e.GetComponent <Detonator>() != null)
             {
                 e.GetComponent <Detonator>().Explode();
             }
         }
         foreach (Transform e in transform)
         {
             if (e.GetComponent <Detonator>() != null)
             {
                 e.parent = null;
             }
         }
         if (explodeFx != null)
         {
             if (explodeFx.GetComponent <Detonator>() != null)
             {
                 GameObject e = (GameObject)Instantiate(explodeFx, transform.position, Quaternion.identity);
                 e.GetComponent <Detonator>().Explode();
                 explodeFx = null;
             }
         }
         transform.parent = null;
         if (gameObject.GetComponent <Rigidbody>() == null)
         {
             Rigidbody r = gameObject.AddComponent <Rigidbody>();
             r.mass           = 10000;
             r.freezeRotation = true;
         }
         Destroy(gameObject, deleteDelay);
         return(true);
     }
     return(false);
 }
예제 #2
0
 /// <summary>
 /// 通常のコンストラクタ
 /// </summary>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <param name="size"></param>
 /// <param name="direction"></param>
 /// <param name="speed"></param>
 public LinearMotionEnemy(int x, int y, int size, int clockDirection, int speed, int shotInterval, ShotBase shot) : base(x, y, size, shotInterval, shot)
 {
     isEnable   = true;
     direction  = Utils.ParseToDirection(clockDirection);
     this.speed = speed;
 }
예제 #3
0
 protected EnemyBase(int x, int y, int size, int shotInterval, ShotBase shot) : base(x, y, size)
 {
     isPlayer          = false;
     this.shotInterval = shotInterval;
     this.shot         = shot;
 }
예제 #4
0
 public bool HitToShot(ShotBase shot)
 {
     meter.Value -= shot.Power;
     return(false);
 }