public IEnumerator zako2_act() { rigidbody_.setDamper(2f); rigidbody_.setRotateDamper(20f); target_position_.x = MyRandom.Range(-5f, 5f); target_position_.y = MyRandom.Range(-5f, 5f); yield return(null); for (var i = new Utility.WaitForSeconds(2.2f, update_time_); !i.end(update_time_);) { rigidbody_.addForceZ(-160f); rigidbody_.addSpringForceXY(target_position_.x, target_position_.y, 2f); yield return(null); } var sec = MyRandom.Range(3f, 5f); var fired_time = update_time_; var move_force = new Vector3(-target_position_.x, -target_position_.y, 0f); move_force.Normalize(); move_force = Quaternion.Euler(0f, 0f, MyRandom.Range(-45f, 45f)) * move_force * 4f; for (var i = new Utility.WaitForSeconds(sec, update_time_); !i.end(update_time_);) { rigidbody_.addTargetTorque(ref Player.Instance.rigidbody_.transform_.position_, 100f); rigidbody_.addForce(ref move_force); var target = Player.Instance.rigidbody_.transform_.position_; if (update_time_ - fired_time > 0.4f) { EnemyBullet.create(ref rigidbody_.transform_.position_, ref target, 50f /* speed */, update_time_); fired_time = update_time_; } yield return(null); } for (var i = new Utility.WaitForSeconds(4f, update_time_); !i.end(update_time_);) { rigidbody_.addOrientTorque(ref CV.Vector3Back, 100f); rigidbody_.addForceZ(-80f); yield return(null); } destroy(); }
public IEnumerator zako_act() { rigidbody_.setDamper(2f); rigidbody_.setRotateDamper(4f); yield return(null); for (var i = new Utility.WaitForSeconds(0.8f, update_time_); !i.end(update_time_);) { rigidbody_.addSpringTorque(ref Player.Instance.rigidbody_.transform_.position_, 3f); rigidbody_.addSpringForceY(4f /* target_y */, 4f /* ratio */); yield return(null); } WaterSurface.Instance.makeBump(ref rigidbody_.transform_.position_, 1f /* value */, 1f /* size */); for (var i = new Utility.WaitForSeconds(1f, update_time_); !i.end(update_time_);) { rigidbody_.addSpringTorque(ref Player.Instance.rigidbody_.transform_.position_, 3f); rigidbody_.addSpringForceY(4f /* target_y */, 4f /* ratio */); if (MyRandom.Probability(0.1f)) { WaterSplash.Instance.spawn(ref rigidbody_.transform_.position_, ref CV.Vector3Zero, update_time_ - 0.2f); } yield return(null); } for (var i = new Utility.WaitForSeconds(10f, update_time_); !i.end(update_time_);) { var pos = Player.Instance.rigidbody_.transform_.position_; // pos.y -= 1f; rigidbody_.addSpringTorque(ref pos, 8f); rigidbody_.addSpringForceY(4f /* target_y */, 4f /* ratio */); if (MyRandom.Probability(0.04f)) { EnemyBullet.create(ref rigidbody_.transform_.position_, ref rigidbody_.transform_.rotation_, 60f /* speed */, update_time_); } yield return(null); } for (var i = new Utility.WaitForSeconds(3f, update_time_); !i.end(update_time_);) { rigidbody_.addHorizontalStableTorque(8f /* torque_level */); rigidbody_.addRelativeForceZ(80f); yield return(null); } destroy(); }
public IEnumerator zako_act() { rigidbody_.setDamper(2f); rigidbody_.setRotateDamper(2f); target_position_.x = MyRandom.Range(-20f, 20); target_position_.y = MyRandom.Range(-20f, 20); rigidbody_.addForceZ(40f); yield return(null); // for (var i = Utility.WaitForSeconds(10f, update_time_); i.MoveNext();) { for (var i = new Utility.WaitForSeconds(10f, update_time_); !i.end(update_time_);) { rigidbody_.addForceX(target_position_.x - rigidbody_.transform_.position_.x * 2f); rigidbody_.addForceY(target_position_.y - rigidbody_.transform_.position_.y * 2f); rigidbody_.addForceZ(10f); rigidbody_.addTorqueZ(-rigidbody_.velocity_.x * 1f); if (MyRandom.ProbabilityForSecond(1.5f, SystemManager.Instance.getDT())) { var pos = Player.Instance.rigidbody_.transform_.position_; pos.z += MyRandom.Range(-10f, 10f); EnemyBullet.create(ref rigidbody_.transform_.position_, ref pos, 50f /* speed */, update_time_); } if (phase_ == Phase.Dying) { // for (var j = Utility.WaitForSeconds(0.1f, update_time_); j.MoveNext();) { for (var j = new Utility.WaitForSeconds(0.1f, update_time_); j.end(update_time_);) { yield return(null); } break; } yield return(null); } destroy(); }
public IEnumerator dragon_act() { double charge_start = update_time_; rigidbody_.setDamper(2f); while (dragon_.mode_ == Dragon.Mode.Attack) { // for (var i = new Utility.WaitForSeconds(30f, update_time_); !i.end(update_time_);) { { { var target = Player.Instance.rigidbody_.transform_.position_ + new Vector3(0f, 0f, 20f); limit_target(ref target, 4f); rigidbody_.addTargetTorque(ref target, 50f /* torque_level */, -1f /* max_level */); rigidbody_.addForwardForce(40f); rigidbody_.addLocalTorqueZ(60f); } if (update_time_ - charge_start < 4f) { dragon_.is_charging_ = true; } else { // dragon_.is_charging_ = false; double fired_time = 0; for (var w = new Utility.WaitForSeconds(4f, update_time_); !w.end(update_time_);) { var target = Player.Instance.rigidbody_.transform_.position_; rigidbody_.addTargetTorque(ref target, 50f /* torque_level */, -1f /* max_level */); if (update_time_ - fired_time > 0.2f) { var muzzle_pos = rigidbody_.transform_.transformPosition(ref MUZZLE_OFFSET); SystemManager.Instance.registSound(DrawBuffer.SE.Missile); EnemyBullet.create(ref muzzle_pos, ref rigidbody_.transform_.rotation_, 50f /* speed */, 2f /* width */, 20f /* length */, update_time_); fired_time = update_time_; } yield return(null); } charge_start = update_time_; } yield return(null); } yield return(null); } for (var i = new Utility.WaitForSeconds(2f, update_time_); !i.end(update_time_);) { rigidbody_.addOrientTorque(ref CV.Vector3Forward, 50f /* torque_level */); rigidbody_.addLocalTorqueZ(60f); rigidbody_.addSpringForceZ(-9f, 0.5f /* ratio */); yield return(null); } rigidbody_.setDamper(8f); { double back_and_force_time = update_time_ + 5f; double fire_time = update_time_ + 1f; while (dragon_.mode_ == Dragon.Mode.Chase) { rigidbody_.addOrientTorque(ref CV.Vector3Forward, 50f /* torque_level */); float phase = Mathf.Repeat((float)update_time_ * 1f, Mathf.PI * 2f); rigidbody_.addLocalTorqueZ(-7f); rigidbody_.addSpringForceXY(Mathf.Cos(phase) * 8f, Mathf.Sin(phase) * 8f, 8f /* ratio */); float target_z = -5f; if (update_time_ - back_and_force_time > 0f) { float p = -40f + Mathf.PerlinNoise(Mathf.Repeat((float)update_time_ * 0.1f, 1f), 0f) * 120f; target_z += p; } rigidbody_.addSpringForceZ(target_z, 20f /* ratio */); if (update_time_ - fire_time > 0f) { if (Player.Instance.rigidbody_.transform_.position_.z > rigidbody_.transform_.position_.z) { SystemManager.Instance.registSound(DrawBuffer.SE.Missile); var muzzle_pos = rigidbody_.transform_.transformPosition(ref MUZZLE_OFFSET); EnemyBullet.create(ref muzzle_pos, ref CV.QuaternionIdentity, 50f /* speed */, 2f /* width */, 20f /* length */, update_time_); } fire_time = update_time_ + 0.2f + Mathf.PerlinNoise(Mathf.Repeat((float)update_time_, 1f), 0f) * 0.5f; } dragon_.addTubeTorque(1f /* power */); yield return(null); } } while (dragon_.mode_ == Dragon.Mode.Farewell) { rigidbody_.addForceZ(-100f); yield return(null); } { for (var w = new Utility.WaitForSeconds(2f, update_time_); !w.end(update_time_);) { yield return(null); } var pos = Player.Instance.rigidbody_.transform_.position_ + new Vector3(0f, 20f, 10f); var rot = Quaternion.Euler(90f, 0f, 0f); reset(ref pos, ref rot); yield return(null); for (var w = new Utility.WaitForSeconds(0.5f, update_time_); !w.end(update_time_);) { rigidbody_.addForwardForce(100f /* force */); rigidbody_.addLocalTorqueZ(10f); yield return(null); } SystemManager.Instance.registBgm(DrawBuffer.BGM.Stop); SystemManager.Instance.setBulletTime(true); for (var w = new Utility.WaitForSeconds(0.5f, update_time_); !w.end(update_time_);) { rigidbody_.addForwardForce(100f /* force */); rigidbody_.addLocalTorqueZ(10f); yield return(null); } for (var w = new Utility.WaitForSeconds(3f, update_time_); !w.end(update_time_);) { var target = new Vector3(0f, 0f, 15f + Player.Instance.rigidbody_.transform_.position_.z); rigidbody_.addTargetTorque(ref target, 25f /* torque_level */, -1f /* max_level */); rigidbody_.addLocalTorqueZ(-40f); rigidbody_.addForwardForce(200f /* force */); yield return(null); } SystemManager.Instance.setBulletTime(false); for (var w = new Utility.WaitForSeconds(30f, update_time_); !w.end(update_time_);) { rigidbody_.addForwardForce(100f /* force */); rigidbody_.addForceZ(-300f /* force */); yield return(null); } } for (;;) { yield return(null); } }