Exemple #1
0
        private void zako_update(float dt)
        {
            if (phase_ == Phase.Alive)
            {
                if (MyCollider.getHitOpponentForEnemy(collider_) != MyCollider.Type.None)
                {
                    float p = 100f;
                    rigidbody_.addTorque(MyRandom.Range(-p, p),
                                         MyRandom.Range(-p, p),
                                         MyRandom.Range(-p, p));
                    life_ -= MyCollider.getHitPowerForEnemy(collider_);

                    if (life_ <= 0f)
                    {
                        Explosion.Instance.spawn(ref rigidbody_.transform_.position_, update_time_);
                        Hahen.Instance.spawn(ref rigidbody_.transform_.position_, update_time_);
                        SystemManager.Instance.registSound(DrawBuffer.SE.Explosion);
                        MyCollider.disableForEnemy(collider_);
                        phase_ = Phase.Dying;
                    }
                    else
                    {
                        Vector3 pos;
                        MyCollider.getIntersectPointForEnemy(collider_, out pos);
                        Spark.Instance.spawn(ref pos, Spark.Type.Bullet, update_time_);
                    }
                }
            }
            rigidbody_.update(dt);
            MyCollider.updateEnemy(collider_, ref rigidbody_.transform_.position_);
            MyCollider.updateEnemyHoming(collider_homing_, ref rigidbody_.transform_.position_);
        }