Пример #1
0
 public override void destroy()
 {
     Beam2.Instance.destroy(beam_id_);
     beam_id_ = -1;
     MyCollider.destroyEnemyBullet(collider_);
     base.destroy();
 }
Пример #2
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;
            }
        }
Пример #3
0
        public override void init()
        {
            base.init();
            rigidbody_.init();
            rigidbody_.setDamper(8f);
            collider_ = MyCollider.createPlayer();
            MyCollider.initSpherePlayer(collider_, ref rigidbody_.transform_.position_,
                                        0.5f /* radius */);
            target_cursor_.init();
            target_cursor_.transform_.position_.z = 32f;
            target_cursor_.setDamper(8f);
            fire_time_          = 0f;
            pitch_acceleration_ = 0f;
            pitch_velocity_     = 0f;
            pitch_       = 0f;
            roll_        = 0f;
            roll_target_ = 0f;

            float width = 0.3f;
            // var color = new Color(0.1f, 0.6f, 1.0f);
            var lpos = rigidbody_.transform_.transformPosition(ref l_trail_locator_);

            l_trail_ = Trail.Instance.spawn(ref lpos, width, Trail.Type.Player);
            var rpos = rigidbody_.transform_.transformPosition(ref r_trail_locator_);

            r_trail_ = Trail.Instance.spawn(ref rpos, width, Trail.Type.Player);

            // auto play
            enumerator_       = auto_play(); // この瞬間は実行されない
            autoplay_buttons_ = new int[8] {
                0, 0, 0, 0, 0, 0, 0, 0,
            };
            hit_wall_ = false;
        }
Пример #4
0
        public override void update(float dt, double update_time)
        {
            if (is_held_)
            {
                return;
            }

            if (MyCollider.isDisabledBullet(collider_) && update_time - start_ > 0.1)
            {
                MyCollider.disableForBullet(collider_, false);
            }

            var collider_type = MyCollider.getHitOpponentForBullet(collider_);

            if (collider_type != MyCollider.Type.None)
            {
                if (collider_type == MyCollider.Type.EnemyHoming)
                {
                    Vector3 target;
                    MyCollider.getHitOpponentInfoPositionForBullet(collider_, out target);
                    var diff = target - rigidbody_.transform_.position_;
                    Vector3.Normalize(diff);
                    const float speed = 10f;
                    diff *= speed;
                    rigidbody_.setVelocity(ref diff);
                }
                else
                {
                    Spark.Instance.spawn(ref rigidbody_.transform_.position_, Spark.Type.Bullet, update_time);
                    destroy();
                    return;
                }
            }

            if (rigidbody_.transform_.position_.y < 0f)
            {
                WaterSurface.Instance.makeBump(ref rigidbody_.transform_.position_, 0.5f /* value */, 1f /* size */);
                destroy();
                var pos = new Vector3(rigidbody_.transform_.position_.x, -0.5f, rigidbody_.transform_.position_.z);
                for (var i = 0; i < 8; ++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;
            }

            prev_position_ = rigidbody_.transform_.position_;
            rigidbody_.update(dt);
            MyCollider.updateBullet(collider_, ref rigidbody_.transform_.position_);

            if (update_time - start_ > MyRandom.Range(2f, 2.5f))       // 寿命
            {
                destroy();
                return;
            }
        }
Пример #5
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_);
        }
Пример #6
0
        public override void update(float dt, float update_time)
        {
            if (MyCollider.getHitOpponentForBullet(collider_) != MyCollider.Type.None)
            {
                Spark.Instance.spawn(ref rigidbody_.transform_.position_, Spark.Type.Bullet, update_time);
                destroy();
                return;
            }

            rigidbody_.update(dt);
            MyCollider.updateBullet(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.Bullet, update_time);
                destroy();
                return;
            }

            if (update_time - start_ > 1f)       // 寿命
            {
                destroy();
                return;
            }
        }
Пример #7
0
        public void update(float dt, double update_time, ref MyTransform parent_transform)
        {
            if (MyCollider.getHitOpponentForEnemy(collider_) != MyCollider.Type.None)
            {
                rigidbody_.addTorque(MyRandom.Range(-20f, 20f),
                                     MyRandom.Range(-20f, 20f),
                                     MyRandom.Range(-20f, 20f));
            }
            if (lock_target_.isHitted())
            {
                rigidbody_.addTorque(MyRandom.Range(-200f, 200f),
                                     MyRandom.Range(-200f, 200f),
                                     MyRandom.Range(-200f, 200f));
                lock_target_.clearLock();
                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);
            }
            rigidbody_.addSpringTorque(ref parent_transform.rotation_, 30f /* torque_level */);
            var pos = parent_transform.transformPosition(ref locator_);

            rigidbody_.transform_.position_ = pos;
            rigidbody_.update(dt);
            MyCollider.updateEnemy(collider_, ref rigidbody_.transform_.position_);
            lock_target_.update();
        }
Пример #8
0
        private void zako2_update(float dt, float flow_speed)
        {
            if (MyCollider.getHitOpponentForEnemy(collider_) != MyCollider.Type.None)
            {
                rigidbody_.addTorque(MyRandom.Range(-200f, 200f),
                                     MyRandom.Range(-200f, 200f),
                                     MyRandom.Range(-200f, 200f));
                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();
        }
Пример #9
0
        public override void update(float dt, double update_time, float flow_speed)
        {
            if (MyCollider.getHitOpponentForBullet(collider_) != MyCollider.Type.None)
            {
                Spark.Instance.spawn(ref rigidbody_.transform_.position_, Spark.Type.Bullet, update_time);
                destroy();
                return;
            }

            rigidbody_.update(dt);
            MyCollider.updateBullet(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.Bullet, update_time);
                destroy();
                return;
            }

            if (update_time - start_ > 2f)       // 寿命
            {
                destroy();
                return;
            }
        }
Пример #10
0
 public override void destroy()
 {
     // type_ = Type.None;
     enumerator_ = null;
     lock_target_.destroy();
     lock_target_ = null;
     MyCollider.destroyEnemy(collider_);
     base.destroy();
 }
Пример #11
0
 public void destroy()
 {
     Trail.Instance.destroy(l_trail_);
     l_trail_ = -1;
     Trail.Instance.destroy(r_trail_);
     r_trail_ = -1;
     MyCollider.destroyPlayer(collider_);
     collider_ = -1;
 }
Пример #12
0
 public void init(ref Vector3 position, ref Quaternion rotation)
 {
     base.init();
     rigidbody_.init(ref position, ref rotation);
     collider_ = MyCollider.createBullet();
     MyCollider.initSphereBullet(collider_, ref position, 0.25f /* radius */);
     MyCollider.disableForBullet(collider_, true);
     is_held_ = true;
     start_   = 0;
     beam_id_ = Beam.Instance.spawn(0.25f /* width */, Beam.Type.Bullet);
 }
Пример #13
0
 public void zako2_init(ref Vector3 position, ref Quaternion rotation)
 {
     rigidbody_.init(ref position, ref rotation);
     collider_ = MyCollider.createEnemy();
     MyCollider.initSphereEnemy(collider_, ref position, 1f /* radius */);
     lock_target_      = LockTarget.create(this, new LockTarget.CalcPosition(calc_lock_position_center));
     enumerator_       = zako2_act(); // この瞬間は実行されない
     on_update_        = new OnUpdateFunc(zako2_update);
     on_render_update_ = new OnRenderUpdateFunc(zako2_render_update);
     life_             = 100f;
 }
Пример #14
0
        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_);
                }
            }
        }
Пример #15
0
 public void zako_init(ref Vector3 position, ref Quaternion rotation)
 {
     rigidbody_.init(ref position, ref rotation);
     collider_ = MyCollider.createEnemy();
     MyCollider.initSphereEnemy(collider_, ref rigidbody_.transform_.position_, 0.5f /* radius */);
     collider_homing_ = MyCollider.createEnemyHoming();
     MyCollider.initSphereEnemyHoming(collider_homing_, ref rigidbody_.transform_.position_, 5f /* radius */);
     enumerator_       = zako_act(); // この瞬間は実行されない
     on_update_        = new OnUpdateFunc(zako_update);
     on_render_update_ = new OnRenderUpdateFunc(zako_render_update);
     life_             = 50f;
 }
Пример #16
0
        public void init(ref Vector3 position, ref Quaternion rotation, float speed, double stop_time)
        {
            base.init();
            rigidbody_.init(ref position, ref rotation);
            var dir      = rotation * CV.Vector3Up;
            var velocity = dir * speed;

            rigidbody_.setVelocity(velocity);
            collider_ = MyCollider.createEnemyBullet();
            MyCollider.initSphereEnemyBullet(collider_, ref position, 0.5f /* radius */);
            stop_time_ = stop_time;
        }
Пример #17
0
        public void init(ref Vector3 position, ref Quaternion rotation, float speed, double update_time)
        {
            base.init();
            rigidbody_.init(ref position, ref rotation);
            var dir      = rotation * CV.Vector3Forward;
            var velocity = dir * speed;

            rigidbody_.setVelocity(velocity);
            collider_ = MyCollider.createBullet();
            MyCollider.initSphereBullet(collider_, ref position, 0.5f /* radius */);
            start_   = update_time;
            beam_id_ = Beam.Instance.spawn(0.75f /* width */, Beam.Type.Bullet);
        }
Пример #18
0
 public void restart()
 {
     GameManager.Instance.restart();
     TaskManager.Instance.restart();
     MyCollider.restart();
     LockTarget.restart();
     TubeScroller.Instance.restart();
     Beam.Instance.restart();
     Trail.Instance.restart();
     Sight.Instance.restart();
     setBulletTime(false);
     flow_speed_target_ = 0f;
     flow_speed_        = 0f;
 }
Пример #19
0
 public override void destroy()
 {
     enumerator_ = null;
     if (collider_ >= 0)
     {
         MyCollider.destroyEnemy(collider_);
         collider_ = -1;
     }
     if (collider_homing_ >= 0)
     {
         MyCollider.destroyEnemyHoming(collider_homing_);
         collider_homing_ = -1;
     }
     base.destroy();
 }
Пример #20
0
        private static void check_intersection(ref MyCollider col0, ref MyCollider col1)
        {
            var diff = col1.center_ - col0.center_;
            var len2 = (diff.x * diff.x +
                        diff.y * diff.y +
                        diff.z * diff.z);
            var rad2 = col0.radius_ + col1.radius_;

            rad2 = rad2 * rad2;
            if (len2 < rad2)
            {
                col0.opponent_type_ = col1.type_;
                col1.opponent_type_ = col0.type_;
            }
        }
Пример #21
0
 public void dragon_init(ref Vector3 position, ref Quaternion rotation)
 {
     rigidbody_.init(ref position, ref rotation);
     rigidbody_.setDamper(2f);
     rigidbody_.setRotateDamper(20f);
     collider_ = MyCollider.createEnemy();
     MyCollider.initSphereEnemy(collider_, ref position, 1.5f /* radius */);
     collider_homing_ = MyCollider.createEnemyHoming();
     MyCollider.initSphereEnemyHoming(collider_homing_, ref rigidbody_.transform_.position_, 5f /* radius */);
     enumerator_       = dragon_act(); // この瞬間は実行されない
     on_update_        = new OnUpdateFunc(dragon_update);
     on_render_update_ = new OnRenderUpdateFunc(dragon_render_update);
     life_             = 10000000f;
     dragon_           = dragon_pool_;
     dragon_.init(this, ref rigidbody_.transform_.position_, ref rigidbody_.transform_.rotation_);
 }
Пример #22
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_);
 }
Пример #23
0
        private static void check_intersection(ref MyCollider col0, ref MyCollider col1)
        {
            var diff = col1.center_ - col0.center_;
            var len2 = (diff.x * diff.x +
                        diff.y * diff.y +
                        diff.z * diff.z);
            var rad2 = col0.radius_ + col1.radius_;

            rad2 = rad2 * rad2;
            if (len2 < rad2)
            {
                float len             = Mathf.Sqrt(len2);
                var   intersect_point = col0.center_ + (diff * (col0.radius_ / len));
                col0.opponent_info_.set(col1.type_, ref intersect_point);
                col1.opponent_info_.set(col0.type_, ref intersect_point);
            }
        }
Пример #24
0
        private static void check_homing(ref MyCollider col0, ref MyCollider col1)
        {
            var diff = col1.center_ - col0.center_;
            var len2 = (diff.x * diff.x +
                        diff.y * diff.y +
                        diff.z * diff.z);
            var rad2 = col0.radius_ + col1.radius_;

            rad2 = rad2 * rad2;
            if (len2 < rad2)
            {
                col0.opponent_info_.set(col1.type_, ref col1.center_, col1.power_);
                ++col0.phase_;
                col1.opponent_info_.set(col0.type_, ref col0.center_, col0.power_);
                ++col1.phase_;
            }
        }
Пример #25
0
 public void init(Task task,
                  int idx,
                  ref Vector3 position,
                  ref Quaternion rotation,
                  DrawBuffer.Type draw_type)
 {
     rigidbody_.init(ref position, ref rotation);
     rigidbody_.setRotateDamper(8);
     collider_ = MyCollider.createEnemy();
     MyCollider.initSphereEnemy(collider_, ref position, 1f /* radius */);
     idx_         = idx;
     lock_target_ = LockTarget.create(task, new LockTarget.CalcPosition(this.calc_lock_position));
     locator_     = (idx_ == 0 ?
                     new Vector3(0f, 0f, 0f) :
                     new Vector3(0f, 0f, -3f));
     draw_type_ = draw_type;
 }
Пример #26
0
        public void dragon_init()
        {
            var position = new Vector3(-10f, -5f, 10f);

            rigidbody_.init(ref position, ref CV.QuaternionIdentity);
            rigidbody_.setDamper(2f);
            rigidbody_.setRotateDamper(20f);
            collider_ = MyCollider.createEnemy();
            MyCollider.initSphereEnemy(collider_, ref position, 1f /* radius */);
            lock_target_      = LockTarget.create(this, new LockTarget.CalcPosition(calc_lock_position_dragon));
            enumerator_       = dragon_act(); // この瞬間は実行されない
            on_update_        = new OnUpdateFunc(dragon_update);
            on_render_update_ = new OnRenderUpdateFunc(dragon_render_update);
            life_             = 10000000f;
            dragon_           = dragon_pool_;
            dragon_.init(this, ref rigidbody_.transform_.position_, ref rigidbody_.transform_.rotation_);
        }
Пример #27
0
        private void update_collision(double update_time)
        {
            // shield
            {
                Vector3 intersect_point = new Vector3(0f, 0f, 0f);
                if (MyCollider.getHitOpponentForPlayer(collider_, ref intersect_point) != MyCollider.Type.None)
                {
                    SystemManager.Instance.registSound(DrawBuffer.SE.Shield);
                    Shield.Instance.spawn(ref intersect_point,
                                          ref rigidbody_.transform_.position_,
                                          update_time,
                                          Shield.Type.Green);
                }
            }

            // collider
            MyCollider.updatePlayer(collider_, ref rigidbody_.transform_.position_);
        }
Пример #28
0
        public void init(ref Vector3 position, ref Quaternion rotation, float speed, float update_time)
        {
            base.init(ref position, ref rotation);
            var dir      = rotation * Vector3.forward;
            var velocity = dir * speed;

            rigidbody_.setVelocity(velocity);
            collider_ = MyCollider.createBullet();
            MyCollider.initSphereBullet(collider_, ref position, 1f /* radius */);
            start_   = update_time;
            beam_id_ = Beam.Instance.spawn(0.75f /* width */, Beam.Type.Bullet);
            // beam_id_ = Beam2.Instance.spawn(ref rigidbody_.transform_.position_,
            //                              ref dir,
            //                              1.0f /* length */,
            //                              speed,
            //                              ref col,
            //                              0.75f /* width */);
        }
Пример #29
0
 public void init(Task task,
                  int idx,
                  ref Vector3 position,
                  ref Quaternion rotation,
                  DrawBuffer.Type draw_type)
 {
     rigidbody_.init(ref position, ref rotation);
     rigidbody_.setRotateDamper(8);
     collider_ = MyCollider.createEnemy();
     MyCollider.initSphereEnemy(collider_, ref position, 1.5f /* radius */);
     collider_homing_ = MyCollider.createEnemyHoming();
     MyCollider.initSphereEnemyHoming(collider_homing_, ref rigidbody_.transform_.position_, 1.5f /* radius */);
     idx_     = idx;
     locator_ = (idx_ == 0 ?
                 new Vector3(0f, 0f, 0f) :
                 new Vector3(0f, 0f, -3f));
     draw_type_ = draw_type;
 }
Пример #30
0
        public void init(ref Vector3 position,
                         ref Quaternion rotation,
                         float speed,
                         float width,
                         float length,
                         double update_time)
        {
            base.init();
            rigidbody_.init(ref position, ref rotation);
            var dir      = rotation * CV.Vector3Forward;
            var velocity = dir * speed;

            rigidbody_.setVelocity(velocity);
            collider_ = MyCollider.createEnemyBullet();
            MyCollider.initSphereEnemyBullet(collider_, ref position, width);
            start_   = update_time;
            length_  = length;
            beam_id_ = Beam2.Instance.spawn(width, Beam2.Type.EnemyBullet);
        }
Пример #31
0
 private static void create(ref MyCollider[] pool, ref int pool_index)
 {
     int cnt = 0;
     while (pool[pool_index].alive_) {
     ++pool_index;
     if (pool_index >= pool.Length)
         pool_index = 0;
     ++cnt;
     if (cnt >= pool.Length) {
         Debug.LogError("EXCEED Collider POOL!");
         Debug.Assert(false);
         break;
     }
     }
     pool[pool_index].alive_ = true;
     pool[pool_index].disabled_ = false;
     pool[pool_index].opponent_type_ = Type.None;
 }
Пример #32
0
 private static void check_intersection(ref MyCollider col0, ref MyCollider col1)
 {
     var diff = col1.center_ - col0.center_;
     var len2 = (diff.x * diff.x +
             diff.y * diff.y +
             diff.z * diff.z);
     var rad2 = col0.radius_+col1.radius_;
     rad2 = rad2 * rad2;
     if (len2 < rad2) {
     col0.opponent_type_ = col1.type_;
     col1.opponent_type_ = col0.type_;
     }
 }