Exemplo n.º 1
0
        public override void update(float dt, double update_time, float flow_speed)
        {
            if (MyCollider.getHitOpponentForEnemyBullet(collider_) != MyCollider.Type.None)
            {
                Spark.Instance.spawn(ref rigidbody_.transform_.position_, Spark.Type.EnemyBullet, update_time);
                destroy();
                return;
            }

            rigidbody_.update(dt);
            MyCollider.updateEnemyBullet(collider_, ref rigidbody_.transform_.position_);

            if (TubeScroller.Instance.checkIntersectionWithSphere(ref rigidbody_.transform_.position_,
                                                                  0.5f /* radius */))
            {
                Spark.Instance.spawn(ref rigidbody_.transform_.position_, Spark.Type.EnemyBullet, update_time);
                destroy();
                return;
            }

            if (update_time - start_ > 3f)       // 寿命
            {
                destroy();
                return;
            }
        }
Exemplo n.º 2
0
        public override void update(float dt, float update_time)
        {
            if (MyCollider.getHitOpponentForEnemyBullet(collider_) != MyCollider.Type.None)
            {
                Spark.Instance.spawn(ref rigidbody_.transform_.position_, Spark.Type.EnemyBullet, update_time);
                destroy();
                return;
            }

            rigidbody_.update(dt);
            MyCollider.updateEnemyBullet(collider_, ref rigidbody_.transform_.position_);

            float sqr_dist = (rigidbody_.transform_.position_.x * rigidbody_.transform_.position_.x +
                              rigidbody_.transform_.position_.y * rigidbody_.transform_.position_.y);
            float radius_sqr = Tube.GetRadiusSqr(rigidbody_.transform_.position_.x, rigidbody_.transform_.position_.y);

            if (sqr_dist > radius_sqr)
            {
                Spark.Instance.spawn(ref rigidbody_.transform_.position_, Spark.Type.EnemyBullet, update_time);
                destroy();
                return;
            }

            if (update_time - start_ > 1f)       // 寿命
            {
                destroy();
                return;
            }
        }
Exemplo n.º 3
0
        public override void update(float dt, double update_time)
        {
            if (MyCollider.getHitOpponentForEnemyBullet(collider_) != MyCollider.Type.None)
            {
                Vector3 intersect_point;
                MyCollider.getIntersectPointForEnemyBullet(collider_, out intersect_point);
                Spark.Instance.spawn(ref intersect_point, Spark.Type.EnemyBullet, update_time);
                destroy();
                return;
            }
            if (rigidbody_.transform_.position_.y < 0f)
            {
                WaterSurface.Instance.makeBump(ref rigidbody_.transform_.position_, 0.5f /* value */, 0.5f /* size */);
                destroy();
                var pos = new Vector3(rigidbody_.transform_.position_.x, -0.5f, rigidbody_.transform_.position_.z);
                for (var i = 0; i < 4; ++i)
                {
                    var spread = 2f;
                    var vel    = new Vector3(Mathf.Cos(i * Mathf.PI * (2f / 8f)) * spread,
                                             MyRandom.Range(5f, 7f),
                                             Mathf.Sin(i * Mathf.PI * (2f / 8f)) * spread);
                    WaterSplash.Instance.spawn(ref pos, ref vel, update_time);
                }
                return;
            }

            rigidbody_.update(dt);
            MyCollider.updateEnemyBullet(collider_, ref rigidbody_.transform_.position_);

            if (update_time - start_ > MyRandom.Range(2f, 2.5f))       // 寿命
            {
                destroy();
                return;
            }
        }
Exemplo n.º 4
0
 public override void update(float dt, double update_time, float flow_speed)
 {
     if (update_time > stop_time_)
     {
         rigidbody_.velocity_.x = 0f;
         rigidbody_.velocity_.y = 0f;
     }
     rigidbody_.velocity_.z = flow_speed;
     rigidbody_.update(dt);
     if (rigidbody_.transform_.position_.z < -400f)
     {
         destroy();
         return;
     }
     MyCollider.updateEnemyBullet(collider_, ref rigidbody_.transform_.position_);
 }
Exemplo n.º 5
0
        public override void update(float dt, double update_time)
        {
            if (MyCollider.getHitOpponentForEnemyBullet(collider_) != MyCollider.Type.None)
            {
                Spark.Instance.spawn(ref rigidbody_.transform_.position_, Spark.Type.EnemyBullet, update_time);
                destroy();
                return;
            }
            if (rigidbody_.transform_.position_.y < -16f)
            {
                destroy();
                var pos = new Vector3(rigidbody_.transform_.position_.x, -0.5f,
                                      rigidbody_.transform_.position_.z);
                for (var i = 0; i < 4; ++i)
                {
                    var spread = 2f;
                    var vel    = new Vector3(Mathf.Cos(i * Mathf.PI * (2f / 8f)) * spread,
                                             MyRandom.Range(3f, 7f),
                                             Mathf.Sin(i * Mathf.PI * (2f / 8f)) * spread);
                    WaterSplash.Instance.spawn(ref pos, ref vel, update_time);
                }
                return;
            }

            rigidbody_.update(dt);
            MyCollider.updateEnemyBullet(collider_, ref rigidbody_.transform_.position_);
            var diff = Player.Instance.rigidbody_.transform_.position_ - rigidbody_.transform_.position_;

            if (diff.sqrMagnitude < (50f * 50f))
            {
                WaterSurface.Instance.makeBump(ref rigidbody_.transform_.position_, -1f /* value */, 1f /* size */);
            }
            if (update_time - start_ > 4f)       // 寿命
            {
                destroy();
                return;
            }
        }