示例#1
0
        /// *******************************************************
        /// <summary>Wave進行 / 更新処理</summary>
        /// *******************************************************
        public bool OnUpdate()
        {
            if (ChildScript != null)
            {
                if (ChildScript.OnUpdate() == false)
                {
                    ChildScript = null;
                }
                return(true);
            }


            PastTime++;
            if (PastTime > WaitTime)
            {
                bool isOpenRandom            = false;
                List <ScriptLine> GroupLines = new List <ScriptLine>();

                while (true)
                {
                    if (Scripts == null)
                    {
                        return(false);
                    }
                    if (Scripts.ScriptLine == null)
                    {
                        return(false);
                    }
                    if (LineIndex >= Scripts.ScriptLine.Count)
                    {
                        return(false);
                    }

                    ScriptLine line = Scripts.ScriptLine[LineIndex];
                    LineIndex++;

                    string CommandName = line.CommandName;

                    if (isOpenRandom == true)
                    {
                        if (CommandName.CompareTo("/random") == 0)
                        {
                            isOpenRandom = false;

                            if ((GroupLines != null) && (GroupLines.Count > 0))
                            {
                                float rndtotal = 0;
                                GroupLines.ForEach(grp => rndtotal += grp.GetAttribute("rate").FloatValue);
                                float rndans      = Random.value * rndtotal;
                                int   selectindex = 0;
                                for (int i = 0; i < GroupLines.Count; i++)
                                {
                                    rndans = rndans - GroupLines[i].GetAttribute("rate").FloatValue;
                                    if (rndans <= 0)
                                    {
                                        selectindex = i;
                                        break;
                                    }
                                }
                                string      childname = GroupLines[selectindex].GetAttribute("target").StringValue;
                                ScriptGroup group     = Manager.Group.Find(grp => grp.GroupName == childname);
                                ChildScript = new WaveScript(Manager, this, group);
                                ChildScript.StartWave();
                            }
                        }
                        else if (CommandName.CompareTo("group") == 0)
                        {
                            GroupLines.Add(line);
                        }
                    }
                    else
                    {
                        if (CommandName.CompareTo("interval") == 0)
                        {
                            IntervalLine(line);
                            PastTime = 0;
                            break;
                        }
                        else if (CommandName.CompareTo("random") == 0)
                        {
                            isOpenRandom = true;
                            GroupLines   = new List <ScriptLine>();
                        }
                        else
                        {
                            SpawnLine(line);
                        }
                    }
                }
            }

            return(true);
        }
示例#2
0
        /// *******************************************************
        /// <summary>ステージ進行 / 更新処理</summary>
        /// *******************************************************
        public void OnUpdate()
        {
            if (IsProcStage == false)
            {
                return;
            }
            if (Manager.OnBombRunning == true)
            {
                return;
            }

            Manager.SetWaveNumber(StepIndex / STEP_LNG);

            if (Manager.GetWaveNumber() >= WaveList.Count)
            {
                OnFInishStage();
                return;
            }
            if ((StepIndex % STEP_LNG) == 0)
            {
                string wave_msg = WaveMessage[Manager.GetWaveNumber()];
                if (StageManager.Instance != null)
                {
                    StageManager.Instance.ShowMessage(wave_msg);
                }
                StepIndex++;
            }
            else if ((StepIndex % STEP_LNG) == 1)
            {
                PastTime++;
                if (PastTime > MESSAGE_INTERVAL)
                {
                    StepIndex++;
                    PastTime = 0;
                }
            }
            else if ((StepIndex % STEP_LNG) == 2)
            {
                PastTime++;
                if (PastTime > WaitTime)
                {
                    if (StageManager.Instance != null)
                    {
                        StageManager.Instance.HideMessage();
                    }

                    string wave_name = WaveList[Manager.GetWaveNumber()];

                    if (wave_name.CompareTo("build") == 0)
                    {
                        if (StageManager.Instance != null)
                        {
                            StageManager.Instance.OpenBuildScreen();
                        }
                        StepIndex++;
                    }
                    else
                    {
                        CurrentWave = WaveWarehouse[wave_name];
                        CurrentWave.StartWave();
                    }

                    StepIndex++;
                    WaitTime = WAVE_INTERVAL;
                    PastTime = 0;
                }
            }
            else if ((StepIndex % STEP_LNG) == 3)
            {
                if ((CurrentWave != null) && (CurrentWave.OnUpdate() == false))
                {
                    StepIndex++;
                }
            }
            else if ((StepIndex % STEP_LNG) == 4)
            {
                if (StageManager.Instance == null)
                {
                    return;
                }
                if (StageManager.Instance.IsBuildScreen == true)
                {
                    return;
                }
                if (StageManager.Instance.EnemyCount != 0)
                {
                    return;
                }
                if (FortressControll.Instance != null)
                {
                    return;
                }
                StepIndex++;
            }
        }