Ejemplo n.º 1
0
 private void EnableRenderers()
 {
     if (info.InvisibleModifierConfig.IsAllRendererMode())
     {
         gameObjectComponent.EnableRendererComponent();
     }
     else
     {
         string[] names = info.InvisibleModifierConfig.ListAffectedRenderersName();
         for (int kIndex = 0; kIndex < names.Length; kIndex++)
         {
             gameObjectComponent.EnableRendererComponent(names[kIndex]);
         }
     }
 }
        public void Update(float dt)
        {
            if (IsFinished())
            {
                return;
            }

            if (delayElapsed < delay)
            {
                delayElapsed += dt;
                if (delayElapsed >= delay)
                {
                    Perform();
                    isPrepareEventDispatched = false;
                    // DLog.Log("debug teleport");
                    return;
                }

                if (prepareDispatchCount < info.count)
                {
                    prepareDelayElapsed += dt;
                    // DLog.Log("debug delay prepareDelayElapsed: " + prepareDelayElapsed);
                }
                if (prepareDelayElapsed >= prepareDelay && !isPrepareEventDispatched)
                {
                    isPrepareEventDispatched = true;
                    skill.TriggerEventWithId(info.prepareEventId);
                    prepareDelayElapsed = 0;
                    prepareDispatchCount++;
                    // DLog.Log("debug trigger preparation");
                }

                prepareEndDelayElapsed += dt;
                // DLog.Log("debug prepare END DelayElapsed: " + prepareEndDelayElapsed);
                if (prepareEndDelayElapsed >= prepareEndDelay && !isPrepareEndEventDispatched)
                {
                    isPrepareEndEventDispatched = true;
                    skill.TriggerEventWithId(info.endPrecedingEid);
                    prepareEndDelayElapsed = 0;
                    // DLog.Log("debug trigger preparation END ");
                }
            }
            else
            {
                elapsed += dt;
                if (elapsed >= info.duration && !isTeleportEndTriggered)
                {
                    isTeleportEndTriggered = true;
                    skill.TriggerEventWithId(info.endEventId);
                    GameObject disappearPrefab = info.ShowAppearPrefab();
                    if (disappearPrefab != null)
                    {
                        environment.InstantiateGameObject(disappearPrefab).transform.position = caster.Position();
                    }
                    if (info.invisible && invisibleStats != null)
                    {
                        invisibleStats.SetBaseBoolValue(false);
                        gameObjectComponent.EnableRendererComponent();
                    }
                    isPrepareEndEventDispatched = false;
                }

                if (elapsed >= info.interval && countSoFar < info.count)
                {
                    elapsed -= info.interval;
                    Perform();
                    isPrepareEventDispatched = false;
                    // DLog.Log("debug teleport");
                }

                if (prepareDispatchCount < info.count)
                {
                    prepareDelayElapsed += dt;
                    // DLog.Log("debug prepareDelayElapsed: " + prepareDelayElapsed);
                }
                if (prepareDelayElapsed >= info.interval && !isPrepareEventDispatched)
                {
                    isPrepareEventDispatched = true;
                    prepareDelayElapsed     -= info.interval;
                    skill.TriggerEventWithId(info.prepareEventId);
                    prepareDispatchCount++;
                    // DLog.Log("debug trigger preparation");
                }

                prepareEndDelayElapsed += dt;
                // DLog.Log("debug prepare END DelayElapsed: " + prepareEndDelayElapsed);
                if (prepareEndDelayElapsed >= prepareEndDelay && !isPrepareEndEventDispatched)
                {
                    isPrepareEndEventDispatched = true;
                    skill.TriggerEventWithId(info.endPrecedingEid);
                    prepareEndDelayElapsed -= info.interval;
                    // DLog.Log("debug trigger preparation END ");
                }
            }
        }