public virtual void OnSuceededToCreate(SceneEntityPosAgent agent)
        {
            // Default behavior:
            LodCmpt entityLodCmpt = agent.entity.lodCmpt;

            if (entityLodCmpt != null)
            {
                entityLodCmpt.onDestruct += (e) => { agent.DestroyEntity(); };
            }
        }
 void OnMonsterEdge(LodCmpt lc)
 {
     lc.OnDestroy();
     if (_uiData != null)
     {
         _uiData.CurCount++;
     }
     if (handlerOneDeath != null)
     {
         handlerOneDeath();
     }
 }
예제 #3
0
        public override void OnSuceededToCreate(SceneEntityPosAgent agent)
        {
            //base.OnSuceededToCreate(agent);

            LodCmpt entityLodCmpt = agent.entity.lodCmpt;

            if (entityLodCmpt != null)
            {
                entityLodCmpt.onDestruct += (e) => { agent.DestroyEntity(); };
            }

            _agent.OnSuceededToCreate();
        }
예제 #4
0
        // For SceneMan Coroutine
        IEnumerator CreateEntity()
        {
            mIsProcessing = true;

            int n = 0;

            while (n++ < MaxTimes)
            {
                switch (mType)
                {
                case EntityType.EntityType_Npc:
                    scene.Notify(ESceneNoification.CreateNpc, this);
                    break;

                case EntityType.EntityType_Monster:
                    scene.Notify(ESceneNoification.CreateMonster, this, mIsSave);
                    break;
                }

                if (entity != null)
                {
                    entity.scenarioId = ScenarioId;
                    SkAliveEntity skAlive = entity.GetCmpt <Pathea.SkAliveEntity> ();

                    if (skAlive != null)
                    {
                        skAlive.deathEvent += OnEntityDeath;
                    }

                    // Note: this entity might be group
                    LodCmpt entityLodCmpt = entity.lodCmpt;
                    if (entityLodCmpt != null)
                    {
                        entityLodCmpt.onDestruct += (e) => { DestroyEntity(); };
                    }

                    break;
                }

                yield return(new WaitForSeconds(OneWait));
            }

            mIsProcessing = false;
        }
예제 #5
0
        void CreateEntityStatic()
        {
            scene.Notify(ESceneNoification.CreateDoodad, this, IsSave);

            if (entity != null)
            {
                entity.scenarioId = ScenarioId;

                SkAliveEntity skAlive = entity.GetCmpt <Pathea.SkAliveEntity>();
                if (skAlive != null)
                {
                    skAlive.deathEvent += OnEntityDeath;
                }


                LodCmpt entityLodCmpt = entity.lodCmpt;
                if (entityLodCmpt != null)
                {
                    entityLodCmpt.onDestruct += (e) => { DestroyEntity(); };
                }
            }
        }
        public override void OnSuceededToCreate(SceneEntityPosAgent agent)
        {
            LodCmpt entityLodCmpt = agent.entity.lodCmpt;

            if (entityLodCmpt != null)
            {
                entityLodCmpt.onDestruct += (e) => { agent.DestroyEntity(); };
            }
            if (_bsRate >= 0)
            {
                if (agent.entity.aliveEntity != null)
                {
                    agent.entity.aliveEntity.deathEvent += (a, b) => {
                        SceneMan.self.StartCoroutine(DelayBossReborn(agent));
                    };
                }
            }
            if (_bcn != null)
            {
                SceneMan.RemoveSceneObj(agent);
            }
        }
예제 #7
0
        public bool ForceCreateEntity()
        {
            if (spawnPoint.isDead)
            {
                return(false);
            }

            switch (mType)
            {
            case EntityType.EntityType_Npc:
                scene.Notify(ESceneNoification.CreateNpc, this, false);
                break;

            case EntityType.EntityType_Monster:
                scene.Notify(ESceneNoification.CreateMonster, this, mIsSave, false);
                break;
            }

            if (entity != null)
            {
                SkAliveEntity skAlive = entity.GetCmpt <Pathea.SkAliveEntity>();

                if (skAlive != null)
                {
                    skAlive.deathEvent += OnEntityDeath;
                }

                LodCmpt entityLodCmpt = entity.lodCmpt;
                if (entityLodCmpt != null)
                {
                    entityLodCmpt.onDestruct += (e) => { DestroyEntity(); };
                }

                return(true);
            }

            return(false);
        }
 public virtual void OnMonsterCreated(PeEntity e)
 {
     if (e != null)
     {
         CommonCmpt cc = e.GetCmpt <CommonCmpt>();
         if (cc != null)
         {
             cc.TDObj = gameObject;
             cc.TDpos = gameObject.transform.position;
         }
         SkAliveEntity sae = e.GetCmpt <SkAliveEntity>();
         if (sae != null)
         {
             sae.deathEvent += (t, c) => OnMonsterDeath(e);
             sae.SetAttribute(AttribType.DefaultPlayerID, MonsterBeaconPlayerID);
             sae.SetAttribute(AttribType.CampID, MonsterBeaconCampID);
             LodCmpt lc = e.lodCmpt;
             if (e.lodCmpt != null && PeGameMgr.IsSingle && isSweep)
             {
                 e.lodCmpt.onDestroyView = (p) => OnMonsterEdge(lc);
             }
         }
     }
 }