Esempio n. 1
0
        public override void update(float dt, float update_time)
        {
            update_time_ = update_time;
            if (enumerator_ != null)
            {
                enumerator_.MoveNext();
            }
            if (alive_)
            {
                if (MyCollider.getHitOpponentForEnemy(collider_) != MyCollider.Type.None)
                {
                    rigidbody_.addTorque(MyRandom.Range(-100f, 100f),
                                         MyRandom.Range(-100f, 100f),
                                         MyRandom.Range(-100f, 100f));
                    rigidbody_.addForceZ(-10000f);
                    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_);
                    lock_target_.disable();
                    phase_ = Phase.Dying;
                }
                if (lock_target_.isHitted())
                {
                    rigidbody_.addTorque(MyRandom.Range(-100f, 100f),
                                         MyRandom.Range(-100f, 100f),
                                         MyRandom.Range(-100f, 100f));
                    rigidbody_.addForceZ(-10000f);
                    lock_target_.clearLock();
                    Explosion.Instance.spawn(ref lock_target_.updated_position_, update_time);
                    Hahen.Instance.spawn(ref lock_target_.updated_position_, update_time);
                    SystemManager.Instance.registSound(DrawBuffer.SE.Explosion);
                    MyCollider.disableForEnemy(collider_);
                    lock_target_.disable();
                    phase_ = Phase.Dying;
                }

                rigidbody_.update(dt);
                MyCollider.updateEnemy(collider_, ref rigidbody_.transform_.position_);
                lock_target_.update();
            }
        }