Ejemplo n.º 1
0
        public void Init()
        {
            var player = CharaFactory.CreatePlayer();

            Main.Instance.stage.charaBank.Add(player);
            wave.Init();
        }
Ejemplo n.º 2
0
 public void UpdateTestEnemy()
 {
     if (!Stage.Current.charaBank.TryGetEnemy(out var enemy))
     {
         enemy = CharaFactory.CreateEnemy(testEnemy.enemyName);
         enemy.data.position = testEnemy.positionList[testEnemyIndex];
         enemy.data.rotation = Quaternion.LookRotation(new Vector2(-1f, 0f));
         Main.Instance.stage.charaBank.Add(enemy);
         testEnemyIndex = (testEnemyIndex + 1) % testEnemy.positionList.Length;;
     }
 }
Ejemplo n.º 3
0
            public void Update()
            {
                if (testEnemy.enabled)
                {
                    UpdateTestEnemy();
                    return;
                }
                if (0 < debugStartTime)
                {
                    if (Stage.Current.time.time < debugStartTime)
                    {
                        Stage.Current.time.time = debugStartTime;
                    }

                    if (debugStartTime + debugLoopDuration < Stage.Current.time.time)
                    {
                        Stage.Current.time.time = debugStartTime;
                    }
                }

                var preTime = Stage.Current.time.preTime;
                var time    = Stage.Current.time.time;

                for (int i = 0, iCount = data.eventList.Length; i < iCount; ++i)
                {
                    var row = data.eventList[i];
                    if (row.type == WaveEventType.None)
                    {
                        continue;
                    }
                    if (!TimeEventData.TryGetEvent(startTime + (row.startTime / 1000f), 0f, preTime, time, out var eventData))
                    {
                        continue;
                    }
                    var pos   = row.position * 16f;
                    var enemy = CharaFactory.CreateEnemy(row.enemyName);
                    enemy.data.position = pos;
                    var vec = Vector2Util.FromDeg(row.angle);
                    enemy.data.rotation = Quaternion.LookRotation((Vector3)vec);
                    enemy.data.velocity = enemy.data.rotation * Vector3.forward;

                    Main.Instance.stage.charaBank.Add(enemy);
                }
            }
Ejemplo n.º 4
0
        void UpdateShot(Chara chara)
        {
            if (!hasShotInput)
            {
                shotTime = 0f;
                return;
            }

            if (shotTime < shotInterval)
            {
                shotTime += Time.deltaTime;
            }
            else
            {
                shotTime = 0f;
                var blt = CharaFactory.CreateBullet();
                blt.data.position = chara.data.position + new Vector3(0f, Random.Range(-2f, 2f), 0f);
                Main.Instance.stage.charaBank.Add(blt);
            }
        }
Ejemplo n.º 5
0
        public void Update()
        {
            charaBank.FixAdd();
            charaBank.RemoveAll(this, (_item, _) => _item == null);
            charaBank.ForEach(this, (_chara, _) => _chara.ManualUpdate());
            if (charaBank.TryGetPlayer(out var player))
            {
                player.GetComponent <Player>().ManualUpdate(player);
            }
            else
            {
                if (UnityEngine.InputSystem.Mouse.current.leftButton.wasPressedThisFrame)
                {
                    player = CharaFactory.CreatePlayer();
                    Main.Instance.stage.charaBank.Add(player);
                }
            }
            wave.Update();


            time.Update(UnityEngine.Time.deltaTime);
        }
Ejemplo n.º 6
0
        public static void ShotToPlayer(Chara self, ShotParam prm)
        {
            var blt = CharaFactory.CreateBullet2();

            Stage.Current.charaBank.Add(blt);
            blt.data.position = self.data.position;
            Vector3 target;

            if (Stage.Current.charaBank.TryGetPlayer(out var player))
            {
                target = player.data.position;
            }
            else
            {
                target = self.data.position + self.data.rotation * Vector3.forward;
            }
            Vector3 toTarget = (target - blt.data.position).ToXY0_Ext();

            blt.data.rotation  = Quaternion.LookRotation(toTarget);
            blt.data.position += blt.data.rotation * prm.offsetPos;
            blt.data.rotation *= prm.offsetRot;
            blt.data.velocity  = blt.data.rotation * Vector3.forward * 60f;
            blt.ApplyTransform();
        }