private void dragon_update(float dt, float flow_speed) { if (MyCollider.getHitOpponentForEnemy(collider_) != MyCollider.Type.None) { rigidbody_.addTorque(MyRandom.Range(-20f, 20f), MyRandom.Range(-20f, 20f), MyRandom.Range(-20f, 20f)); life_ -= 20f; } if (lock_target_.isHitted()) { rigidbody_.addTorque(MyRandom.Range(-200f, 200f), MyRandom.Range(-200f, 200f), MyRandom.Range(-200f, 200f)); lock_target_.clearLock(); life_ -= 100f; } if (life_ <= 0f && phase_ == Phase.Alive) { Explosion.Instance.spawn(ref lock_target_.updated_position_, update_time_); Hahen.Instance.spawn(ref lock_target_.updated_position_, update_time_); Shockwave.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(); var head_transform = rigidbody_.transform_.add(ref HEAD_OFFSET); dragon_.update(dt, update_time_, ref head_transform); }
private void dragon_update(float dt) { 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_ -= 20f; } if (life_ <= 0f && phase_ == Phase.Alive) { MyCollider.disableForEnemy(collider_); phase_ = Phase.Dying; } rigidbody_.update(dt); MyCollider.updateEnemy(collider_, ref rigidbody_.transform_.position_); MyCollider.updateEnemyHoming(collider_homing_, ref rigidbody_.transform_.position_); // var head_transform = rigidbody_.transform_.add(ref HEAD_OFFSET); dragon_.update(dt, update_time_, ref rigidbody_); if (MyRandom.Probability(0.01f)) { var head_pos = new Vector3(0f, 0f, 2f); var pos = rigidbody_.transform_.transformPosition(ref head_pos); if (pos.y > 0f) { EnemyLaser.create(ref pos, ref rigidbody_.transform_.rotation_, 40f /* speed */, update_time_); SystemManager.Instance.registSound(DrawBuffer.SE.Laser); } } if (MyRandom.Probability(0.1f)) { var pos = rigidbody_.transform_.position_; pos.x += MyRandom.Range(-1f, 1f); pos.z += MyRandom.Range(-1f, 1f); WaterSplash.Instance.spawn(ref pos, ref CV.Vector3Zero, update_time_ - 0.2f); } if (-1f < rigidbody_.transform_.position_.y && rigidbody_.transform_.position_.y < 1f) { WaterSurface.Instance.makeBump(ref rigidbody_.transform_.position_, -0.1f /* value */, 1f /* size */); if (MyRandom.Probability(0.1f)) { var wpos = rigidbody_.transform_.position_; wpos.y = -2f; var vel = new Vector3(0f, MyRandom.Range(5f, 8f), 0f); WaterSplash.Instance.spawn(ref wpos, ref vel, update_time_); } } }