Esempio n. 1
0
 public override void ActiveTrigger()
 {
     if (m_Triggers == null)
     {
         return;
     }
     for (int i = 0; i < m_Triggers.Count; i++)
     {
         GameObject locator = LocatorManager.Instance.GetLocator(m_Triggers[i].locator);
         if (locator != null)
         {
             TransferTriggerEntry tte = m_Triggers[i] as TransferTriggerEntry;
             ParticleSystem       mFX = PSPoolManager.Instance.Use(locator, "fx_p_CJ_chuansongmen");
             if (mFX != null)
             {
                 mFX.transform.position = locator.transform.position;
                 mFX.EnableEmission(true);
                 mFX.Simulate(0.0001f, true, true);
                 mFX.Play(true);
                 tte.particle = mFX;
             }
             BoxCollider collider = locator.GetComponent <BoxCollider>();
             if (collider != null)
             {
                 if (!collider.enabled)
                 {
                     collider.enabled = true;
                 }
             }
         }
     }
 }
Esempio n. 2
0
 public override void ClearTrigger()
 {
     if (m_Triggers != null)
     {
         for (int i = 0; i < m_Triggers.Count; i++)
         {
             TransferTriggerEntry tte = m_Triggers[i] as TransferTriggerEntry;
             if (tte.particle != null)
             {
                 tte.particle.name = tte.particle.name.Replace("(Clone)", "");
                 PSPoolManager.Instance.Recycle(tte.particle);
             }
         }
     }
 }
Esempio n. 3
0
        public void InitMap(Dictionary <string, MainLandTemplate> MainLandTbl)
        {
            t = new int[MainLandTbl.Count][];
            for (int i = 0; i < t.Length; i++)
            {
                t[i] = new int[MainLandTbl.Count];
            }

            map = new WorldPathNode[MainLandTbl.Count][];
            for (int i = 0; i < map.Length; i++)
            {
                map[i] = new WorldPathNode[MainLandTbl.Count];
            }

            indexmap = new Dictionary <string, WorldSceneStruct>();
            List <MainLandTemplate> mainlands = new List <MainLandTemplate>(MainLandTbl.Values);

            for (int i = 0; i < mainlands.Count; i++)
            {
                WorldSceneStruct wss = new WorldSceneStruct();
                wss.index      = i;
                wss.m_Triggers = SceneTemplateManager.GetSceneTransferPoints(mainlands[i].mainland_name, "mainlands");
                indexmap.Add(mainlands[i].mainland_name, wss);
            }
            for (int i = 0; i < mainlands.Count; i++)
            {
                List <TriggerEntry> triggers = indexmap[mainlands[i].mainland_name].m_Triggers;
                if (triggers == null)
                {
                    EB.Debug.LogWarning("WorldMapPathFinder.InitMap: triggers = null!");
                    continue;
                }
                for (int j = 0; j < triggers.Count; j++)
                {
                    TransferTriggerEntry tte = triggers[j] as TransferTriggerEntry;
                    int index = indexmap[tte.name].index;
                    t[i][index] = 1;
                    WorldPathNode wpn = new WorldPathNode();
                    wpn.scene     = mainlands[i].mainland_name;
                    wpn.locator   = tte.locator;
                    map[i][index] = wpn;
                }
            }
        }
Esempio n. 4
0
        public override bool ProcessTriggerEnter(string locator, GameObject trigger)
        {
            TriggerEntry target = null;

            if (m_Triggers == null)
            {
                EB.Debug.LogWarning("TransferTriggerProcessor.ProcessTriggerEnter: m_Triggers = null!");
                return(false);
            }

            for (int i = 0; i < m_Triggers.Count; i++)
            {
                if (m_Triggers[i].locator.Equals(locator))
                {
                    //防止重入,重入会导致场景多次加载
                    if (SceneLogic.SceneState != SceneLogic.eSceneState.SceneLoop || IsTransfering)
                    {
                        return(true);
                    }
                    IsTransfering = true;
                    target        = m_Triggers[i];
                    TransferTriggerEntry tte = target as TransferTriggerEntry;
                    PlayerManager.LocalPlayerController().TargetingComponent.SetMovementTarget(Vector3.zero, true);
                    //PlayerController.LocalPlayerDisableNavigation();
                    UIStack.Instance.ExitStack();
                    EB.Debug.Log("Transfer!!!");
                    Vector3 from_pos = new Vector3(25.0f, 0.0f, 45.0f);
                    SceneLogic.Transfer("mapview", from_pos, 90.0f, tte.name, tte.pos, 90.0f, delegate(bool sucessful)
                    {
                        if (!sucessful)
                        {
                            IsTransfering = false;
                        }
                    });
                    return(true);
                }
            }
            return(false);
        }