Exemple #1
0
        public Single PlayAnimation(EAnimType type, EState changedState, Single duration, Single speed, Single stateExtraTime)
        {
            if (m_AnimationHandler.IsPlaying(EAnimType.DIE) || (m_IsDead && type != EAnimType.DIE))
            {
                m_State.ChangeState(changedState, 0f);
                return(0f);
            }
            AnimationState state = m_AnimationHandler.GetState(type);

            if (state != null)
            {
                if (duration == -1f)
                {
                    duration = state.length / speed;
                }
                m_AnimationHandler.Play(type, duration);
                m_State.ChangeState(changedState, duration + stateExtraTime);
                return(duration);
            }
            m_State.ChangeState(changedState, 0f);
            Debug.LogError(String.Concat(new Object[]
            {
                "Missing '",
                type,
                "' animation!\n",
                name
            }), this);
            return(0f);
        }
Exemple #2
0
        protected override void OnDie()
        {
            m_StartTime  = Time.time;
            m_Targettime = m_StartTime + ANIM_TIME - destroytime;
            m_DieStart   = true;
            Destroy(this.gameObject, ANIM_TIME);
            if (m_lightOffAnim_1 != null && m_lightOffAnim_2 != null)
            {
                m_lightOffAnim_1.Play();
                m_lightOffAnim_2.Play();
            }
            m_AnimHandler.Play(deathanimname);
            GameObject gameObject = Helper.Instantiate <GameObject>(m_effect);

            gameObject.transform.position = transform.position + m_spawnEffectOffset;
            if (mamushi)
            {
                gameObject.particleSystem.Play();
                AudioManager.Instance.RequestPlayAudioID("mamushidie", 0, -1f, transform.position, null, 1f, 0f, 0f, null);
                DelayedEventManagerWorker delayedEventManagerWorker = new GameObject("Mamushi Script Worker").AddComponent <DelayedEventManagerWorker>();
                delayedEventManagerWorker.transform.position = transform.position;
                DontDestroyOnLoad(delayedEventManagerWorker);
                delayedEventManagerWorker.StartCoroutine(PlayLateShakeFX(delayedEventManagerWorker));
            }
        }
Exemple #3
0
        private void Update()
        {
            Transform transform = FXMainCamera.Instance.CurrentCamera.transform;

            transform.localPosition = Vector3.Lerp(transform.localPosition, Vector3.zero, Time.deltaTime * 4f);
            transform.localRotation = Quaternion.Lerp(transform.localRotation, Quaternion.identity, Time.deltaTime * 4f);
            if (!m_barkTriggered && m_CameraMover.Timer >= m_TiggerBark)
            {
                m_barkTriggered = true;
                GameObject gameObject = ViewManager.Instance.FindView(m_IvenSpawnerID);
                if (gameObject != null)
                {
                    AnimHandler componentInChildren = gameObject.GetComponentInChildren <AnimHandler>();
                    if (componentInChildren != null)
                    {
                        componentInChildren.Play("Command");
                    }
                    else
                    {
                        Debug.LogError("not found iven anim view " + m_IvenSpawnerID);
                    }
                }
                else
                {
                    Debug.LogError("not found iven " + m_IvenSpawnerID);
                }
            }
            if (!m_titleTriggered && m_CameraMover.Timer >= m_TiggerTitleLabel)
            {
                m_titleTriggered = true;
                m_TitleLabel.Show();
            }
            if (!m_finishTriggered && m_CameraMover.Timer >= 1f)
            {
                m_finishTriggered = true;
                StartCoroutine(StopCutscene(1f));
            }
        }
        protected virtual void OnEntityAbilityAdded(Object p_sender, EventArgs p_args)
        {
            AbilityEventArgs abilityEventArgs = (AbilityEventArgs)p_args;

            if (abilityEventArgs.Monster == MyController)
            {
                String gfx       = abilityEventArgs.Ability.StaticData.Gfx;
                String animation = abilityEventArgs.Ability.StaticData.Animation;
                if (!String.IsNullOrEmpty(animation))
                {
                    Int32 animationID = Int32.Parse(animation);
                    if (m_old)
                    {
                        m_Animation.Play(animation, -1f, 1f);
                    }
                    else if (m_animatorControl.DieState == 0)
                    {
                        m_animatorControl.AttackMagic(animationID);
                    }
                }
                if (!String.IsNullOrEmpty(gfx))
                {
                    if (gfx == "SKIP_FX")
                    {
                        return;
                    }
                    BuffFX buffFX = Helper.ResourcesLoad <BuffFX>(gfx, false);
                    if (buffFX != null)
                    {
                        buffFX = Helper.Instantiate <BuffFX>(buffFX);
                        FXQueue fxqueue = new GameObject(name + " " + buffFX.name + " FXQueue").AddComponent <FXQueue>();
                        fxqueue.SetData(new FXQueue.Entry[]
                        {
                            new FXQueue.Entry(buffFX, 0f, 0f)
                        }, 0);
                        if (abilityEventArgs.Ability.StaticData.TargetType == ETargetType.PARTY)
                        {
                            FXArgs args = new FXArgs(gameObject, FXHelper.GetPlayerEntity().gameObject, gameObject, FXHelper.GetPlayerEntity().gameObject, transform.position, transform.forward, -transform.right, FXHelper.GetPlayerEntity().transform.position, new List <GameObject>
                            {
                                FXHelper.GetPlayerEntity().gameObject
                            });
                            fxqueue.Execute(args);
                        }
                        else
                        {
                            FXArgs args2 = new FXArgs(gameObject, gameObject, gameObject, gameObject, transform.position, transform.forward, -transform.right, transform.position, new List <GameObject>
                            {
                                gameObject
                            });
                            fxqueue.Execute(args2);
                        }
                        m_Queues.Add(fxqueue);
                    }
                    else
                    {
                        Debug.LogError("OnAbilityEvent: Ability's  given GFX does not exist! " + gfx);
                    }
                }
                else
                {
                    Debug.LogWarning("OnAbilityEvent: Ability GFX is missing!");
                }
                if (abilityEventArgs.Ability.StaticData.NameKey == "MONSTER_ABILITY_EXPLOSIVE")
                {
                    DelayedEventManagerWorker delayedEventManagerWorker = new GameObject("ExplosiveHelper").AddComponent <DelayedEventManagerWorker>();
                    DontDestroyOnLoad(delayedEventManagerWorker);
                    delayedEventManagerWorker.StartCoroutine(PlayLateShakeFX(delayedEventManagerWorker.gameObject));
                    Destroy(gameObject, m_explosiveAbilityDelay);
                }
            }
        }
Exemple #5
0
        private void OnMonsterCastSpell(Object p_sender, EventArgs p_args)
        {
            if (p_sender != MyController)
            {
                return;
            }
            SpellEventArgs args         = (SpellEventArgs)p_args;
            MonsterSpell   monsterSpell = (MonsterSpell)args.Spell;
            EventHandler   eventHandler = delegate(Object sender, EventArgs e)
            {
                DelayedEventManager.InvokeEvent(EDelayType.ON_FX_HIT, EEventType.MONSTER_CAST_SPELL, p_sender, p_args);
                MyController.AttackingDone.Trigger();
                if (MyController is Monster)
                {
                    MyController.BuffHandler.FlushActionLog(MonsterBuffHandler.ELogEntryPhase.ON_CAST_SPELL);
                    MyController.BuffHandler.RemoveFlaggedBuffs();
                }
                SpellEffectEntryEventArgs p_args9 = new SpellEffectEntryEventArgs(p_sender, args);
                LegacyLogic.Instance.ActionLog.PushEntry(p_args9);
                foreach (SpellTarget spellTarget2 in args.SpellTargets)
                {
                    if (spellTarget2.Target is Character)
                    {
                        ((Character)spellTarget2.Target).ConditionHandler.FlushActionLog();
                        ((Character)spellTarget2.Target).ConditionHandler.FlushDelayedActionLog();
                        LegacyLogic.Instance.WorldManager.Party.Buffs.FlushActionLog();
                    }
                }
                if (MyController is Monster)
                {
                    MyController.BuffHandler.FlushActionLog(MonsterBuffHandler.ELogEntryPhase.ON_END_TURN);
                }
            };
            FXDescription fxdescription = Helper.ResourcesLoad <FXDescription>(monsterSpell.EffectKey, false);

            if (fxdescription == null)
            {
                Debug.LogError("FXDescription not found! at " + monsterSpell.EffectKey, this);
                eventHandler(this, EventArgs.Empty);
                return;
            }
            fxdescription           = Helper.Instantiate <FXDescription>(fxdescription);
            fxdescription.Finished += eventHandler;
            Vector3 p_slotOriginPosition;
            Vector3 p_slotForward;
            Vector3 p_slotLeft;
            Vector3 p_slotTargetPosition;

            ViewManager.GetSlotDatas(MyController.Position, LegacyLogic.Instance.WorldManager.Party.Position, out p_slotOriginPosition, out p_slotForward, out p_slotLeft, out p_slotTargetPosition);
            m_Animation.Play(monsterSpell.EffectAnimationClip, -1f, 1f);
            GameObject  gameObject = this.gameObject;
            ETargetType targetType = monsterSpell.TargetType;

            if (args.SpellTargets.Count == 0)
            {
                Debug.LogError("Error, missing targets for effects\n" + DebugUtil.DumpObjectText(monsterSpell));
                FXArgs p_args2 = new FXArgs(gameObject, gameObject, gameObject, gameObject, p_slotOriginPosition, p_slotForward, p_slotLeft, p_slotTargetPosition);
                fxdescription.Configurate(m_AnimationEvents, p_args2);
                return;
            }
            if ((targetType & ETargetType.MONSTER) == ETargetType.MONSTER)
            {
                PlayerEntityView  playerEntityView = ViewManager.Instance.FindViewAndGetComponent <PlayerEntityView>(LegacyLogic.Instance.WorldManager.Party);
                MovingEntity      movingEntity     = null;
                List <GameObject> list             = new List <GameObject>();
                foreach (SpellTarget spellTarget in args.SpellTargets)
                {
                    GameObject gameObject2 = null;
                    if (spellTarget.Target is Character)
                    {
                        if (movingEntity == null)
                        {
                            movingEntity = LegacyLogic.Instance.WorldManager.Party;
                        }
                        gameObject2 = playerEntityView.GetMemberGameObject(((Character)spellTarget.Target).Index);
                    }
                    else if (spellTarget.Target is MovingEntity)
                    {
                        if (movingEntity == null)
                        {
                            movingEntity = (MovingEntity)spellTarget.Target;
                        }
                        gameObject2 = ViewManager.Instance.FindView((MovingEntity)spellTarget.Target);
                    }
                    if (gameObject2 != null)
                    {
                        list.Add(gameObject2);
                    }
                }
                ViewManager.GetSlotDatas(MyController.Position, movingEntity.Position, out p_slotOriginPosition, out p_slotForward, out p_slotLeft, out p_slotTargetPosition);
                FXArgs p_args3 = new FXArgs(gameObject, playerEntityView.gameObject, gameObject, playerEntityView.gameObject, p_slotOriginPosition, p_slotForward, p_slotLeft, p_slotTargetPosition, list);
                fxdescription.Configurate(m_AnimationEvents, p_args3);
            }
            else if ((targetType & ETargetType.MULTY) == ETargetType.MULTY)
            {
                PlayerEntityView  playerEntityView2 = ViewManager.Instance.FindViewAndGetComponent <PlayerEntityView>(LegacyLogic.Instance.WorldManager.Party);
                List <GameObject> list2             = new List <GameObject>(4);
                for (Int32 i = 0; i < 4; i++)
                {
                    list2.Add(playerEntityView2.GetMemberGameObject(i));
                }
                FXArgs p_args4 = new FXArgs(gameObject, playerEntityView2.gameObject, gameObject, playerEntityView2.gameObject, p_slotOriginPosition, p_slotForward, p_slotLeft, p_slotTargetPosition, list2);
                fxdescription.Configurate(m_AnimationEvents, p_args4);
            }
            else if ((targetType & ETargetType.SINGLE) == ETargetType.SINGLE)
            {
                PlayerEntityView playerEntityView3 = ViewManager.Instance.FindViewAndGetComponent <PlayerEntityView>(LegacyLogic.Instance.WorldManager.Party);
                Boolean          flag = true;
                foreach (AttackedTarget attackedTarget in args.SpellTargetsOfType <AttackedTarget>())
                {
                    Character character = (Character)attackedTarget.Target;
                    if (character == null)
                    {
                        return;
                    }
                    GameObject memberGameObject = playerEntityView3.GetMemberGameObject(character.Index);
                    if (!flag)
                    {
                        fxdescription = Helper.Instantiate <FXDescription>(fxdescription);
                    }
                    FXArgs p_args5 = new FXArgs(gameObject, memberGameObject, gameObject, memberGameObject, p_slotOriginPosition, p_slotForward, p_slotLeft, p_slotTargetPosition, new List <GameObject>
                    {
                        memberGameObject
                    });
                    fxdescription.Configurate(m_AnimationEvents, p_args5);
                    flag = false;
                }
                foreach (MonsterBuffTarget monsterBuffTarget in args.SpellTargetsOfType <MonsterBuffTarget>())
                {
                    Character character2 = (Character)monsterBuffTarget.Target;
                    if (character2 == null)
                    {
                        break;
                    }
                    GameObject memberGameObject2 = playerEntityView3.GetMemberGameObject(character2.Index);
                    if (!flag)
                    {
                        fxdescription = Helper.Instantiate <FXDescription>(fxdescription);
                    }
                    FXArgs p_args6 = new FXArgs(gameObject, memberGameObject2, gameObject, memberGameObject2, p_slotOriginPosition, p_slotForward, p_slotLeft, p_slotTargetPosition, new List <GameObject>
                    {
                        memberGameObject2
                    });
                    fxdescription.Configurate(m_AnimationEvents, p_args6);
                    flag = false;
                }
            }
            else if ((targetType & ETargetType.ADJACENT) == ETargetType.ADJACENT)
            {
                FXArgs p_args7 = new FXArgs(gameObject, gameObject, gameObject, gameObject, p_slotOriginPosition, p_slotForward, p_slotLeft, p_slotTargetPosition);
                fxdescription.Configurate(m_AnimationEvents, p_args7);
            }
            else
            {
                FXArgs p_args8 = new FXArgs(gameObject, gameObject, gameObject, gameObject, p_slotOriginPosition, p_slotForward, p_slotLeft, p_slotTargetPosition);
                fxdescription.Configurate(m_AnimationEvents, p_args8);
            }
        }