Пример #1
0
        public static void UpdateEnemy1(Chara self)
        {
            var preTime = self.data.stateTime;

            self.data.stateTime = Stage.Current.time.time - self.data.spawnedTime;

            if (IsEnterTime(0f, preTime, self.data.stateTime))
            {
                self.data.velocity = self.data.rotation * Vector3.forward * 40f;
            }

            if (IsEnterTime(0.5f, preTime, self.data.stateTime))
            {
                self.data.velocity = self.data.rotation * Vector3.forward * 20f;
            }

            if (IsEnterTime(2f, preTime, self.data.stateTime))
            {
                ShotToPlayer(self, ShotParam.Create());
            }

            // if (IsEnterTime(4f, preTime, self.data.stateTime)) {
            //  ShotToPlayer(self, ShotParam.Create(Vector3.zero, Quaternion.Euler(15f, 0f, 0f)));
            //  ShotToPlayer(self, ShotParam.Create(Vector3.zero, Quaternion.Euler(-15f, 0f, 0f)));
            // }
        }
Пример #2
0
        /// <summary>一定時間追尾</summary>
        public static void UpdateEnemy3(Chara self)
        {
            TimeEventData evtData;
            var           preTime = self.data.stateTime;

            self.data.stateTime = Stage.Current.time.time - self.data.spawnedTime;

            if (IsEnterTime(0f, preTime, self.data.stateTime))
            {
                self.data.velocity = self.data.rotation * Vector3.forward * 40f;
            }

            if (IsEnterTime(0.5f, preTime, self.data.stateTime))
            {
                self.data.velocity = self.data.rotation * Vector3.forward * 20f;
            }

            // 方向合わせ.
            if (TimeEventData.TryGetEvent(0.5f, 5f, preTime, self.data.stateTime, out evtData))
            {
                switch (evtData.type)
                {
                case TimeEventType.Exit:
                    break;

                default:
                    if (Stage.Current.charaBank.TryGetPlayer(out var player))
                    {
                        self.data.rotation = LookAtAngle(self, player.data.position, 60);
                    }
                    break;
                }
            }

            // 直進.
            if (TimeEventData.TryGetEvent(0.5f, 10f, preTime, self.data.stateTime, out evtData))
            {
                switch (evtData.type)
                {
                case TimeEventType.Exit:
                    break;

                default:
                    self.data.velocity = self.data.rotation * Vector3.forward * 40f;
                    break;
                }
            }

            // 射撃.
            if (IsEnterTime(2f, preTime, self.data.stateTime))
            {
                ShotToPlayer(self, ShotParam.Create());
            }
        }
Пример #3
0
        /// <summary>画面中央を横切ってから弧を描く</summary>
        public static void UpdateEnemy4(Chara self)
        {
            TimeEventData evtData;
            var           preTime = self.data.stateTime;

            self.data.stateTime = Stage.Current.time.time - self.data.spawnedTime;

            // 直進.
            if (TimeEventData.TryGetEvent(0.0f, 10f, preTime, self.data.stateTime, out evtData))
            {
                switch (evtData.type)
                {
                case TimeEventType.Exit:
                    break;

                default:
                    self.data.velocity = self.data.rotation * Vector3.forward * 80f;
                    break;
                }
            }

            // 方向合わせ.
            if (TimeEventData.TryGetEvent(0.5f, 1f, preTime, self.data.stateTime, out evtData))
            {
                switch (evtData.type)
                {
                case TimeEventType.Exit:
                    break;

                default:
                    var target = GetPositionFromScreenCenter(new Vector2(0f, 0f));
                    target.x           = self.data.spawnedPosition.x;
                    self.data.rotation = LookAtAngle(self, target, 60f);
                    break;
                }
            }

            // 射撃.
            if (IsEnterTime(1.2f, preTime, self.data.stateTime))
            {
                ShotToPlayer(self, ShotParam.Create());
            }
        }
Пример #4
0
        public static void UpdateEnemy2(Chara self)
        {
            var preTime = self.data.stateTime;

            self.data.stateTime = Stage.Current.time.time - self.data.spawnedTime;
            TimeEventData evtData;

            if (TimeEventData.TryGetEvent(0f, 0.5f, preTime, self.data.stateTime, out evtData))
            {
                switch (evtData.type)
                {
                case TimeEventType.Exit:
                    self.data.velocity = self.data.rotation * Vector3.forward * 0f;
                    break;

                default:
                    self.data.velocity = self.data.rotation * Vector3.forward * 40f;
                    break;
                }
            }

            if (TimeEventData.TryGetEvent(0.5f, 9f, preTime, self.data.stateTime, out evtData))
            {
                switch (evtData.type)
                {
                case TimeEventType.Exit:
                    self.data.velocity = self.data.rotation * Vector3.forward * 0f;
                    break;

                default:
                    self.data.velocity = self.data.rotation * Vector3.forward * 5f;
                    break;
                }
            }

            if (TimeEventData.TryGetEvent(10f, 5f, preTime, self.data.stateTime, out evtData))
            {
                switch (evtData.type)
                {
                case TimeEventType.Exit:
                    self.data.velocity = self.data.rotation * Vector3.forward * 0f;
                    break;

                default:
                    self.data.velocity = self.data.rotation * Vector3.forward * 40f;
                    break;
                }
            }

            if (TimeEventData.TryGetEvent(15f, 0f, preTime, self.data.stateTime, out evtData))
            {
                GameObject.Destroy(self.gameObject);
            }

            if (TimeEventData.TryGetEvent(2f, 0f, preTime, self.data.stateTime, out evtData))
            {
                ShotToPlayer(self, ShotParam.Create(Vector3.zero, Quaternion.Euler(30f, 0f, 0f)));
                ShotToPlayer(self, ShotParam.Create(Vector3.zero, Quaternion.Euler(-30f, 0f, 0f)));
            }

            if (TimeEventData.TryGetEvent(2.5f, 0f, preTime, self.data.stateTime, out evtData))
            {
                ShotToPlayer(self, ShotParam.Create(Vector3.zero, Quaternion.Euler(20f, 0f, 0f)));
                ShotToPlayer(self, ShotParam.Create(Vector3.zero, Quaternion.Euler(-20f, 0f, 0f)));
            }

            if (TimeEventData.TryGetEvent(3f, 0f, preTime, self.data.stateTime, out evtData))
            {
                ShotToPlayer(self, ShotParam.Create(Vector3.zero, Quaternion.Euler(15f, 0f, 0f)));
                ShotToPlayer(self, ShotParam.Create(Vector3.zero, Quaternion.Euler(-15f, 0f, 0f)));
            }
        }