Example #1
0
        private void DealAoe(AoeCom aoeCom)
        {
            float timePassed = SkillLocate.DeltaTime;

            if (aoeCom.Aoes == null || aoeCom.Aoes.Count <= 0)
            {
                return;
            }

            for (int i = 0; i < aoeCom.Aoes.Count; i++)
            {
                AoeObj aoeObj = aoeCom.Aoes[i];

                //移动
                if (aoeObj.duration > 0 && aoeObj.model.moveFunc != null)
                {
                    AoeMoveInfo aoeMoveInfo = aoeObj.model.moveFunc.Execute(aoeObj, aoeObj.moveRunnedTime);
                    aoeObj.moveRunnedTime += timePassed;
                    aoeObj.SetMoveInfo(aoeMoveInfo);
                }

                if (aoeObj.justCreated)
                {
                    aoeObj.justCreated = false;
                    //检测进入的演员
                    var enterActors = Sensor.GetActorsInRange(aoeObj);
                    ExecuteActorEnterFunc(aoeObj, enterActors);
                    aoeObj.actorInRange.AddRange(enterActors);

                    //检测进入的子弹
                    var enterBullets = Sensor.GetBulletsInRange(aoeObj);
                    ExecuteBulletEnterFunc(aoeObj, enterBullets);
                    aoeObj.bulletInRange.AddRange(enterBullets);

                    //执行OnCreate
                    ExecuteCreateFunc(aoeObj);
                }
                else
                {
                    UpdateActors(aoeObj);
                    UpdateBullets(aoeObj);
                }

                //Aoe生命周期
                aoeObj.duration    -= timePassed;
                aoeObj.timeElapsed += timePassed;
                if (aoeObj.duration <= 0)
                {
                    ExecuteRemoveFunc(aoeObj);
                    aoeCom.RemoveAoe(aoeObj);
                    DestroyAoe(aoeObj);
                }
                else
                {
                    ExecuteOnTickFunc(aoeObj);
                }
            }
        }
Example #2
0
        protected override void HandleComs(List <BaseCom> comList)
        {
            AoeCom aoeCom = GetCom <AoeCom>(comList[0]);

            DealAoe(aoeCom);
        }