public BattleAnimation GetCopy(int index)
    {
        BattleAnimation ba = new BattleAnimation();
        ba.realID = index;

        ba.step = new AnimationStep[animation[index].step.Length];
        for(int i=0; i<ba.step.Length; i++)
        {
            ba.step[i] = animation[index].step[i].GetCopy(ba);
        }

        ba.hideButtons = animation[index].hideButtons;
        ba.returnToBaseCamPos = animation[index].returnToBaseCamPos;
        ba.returnLooks = animation[index].returnLooks;
        ba.calculationNeeded = animation[index].calculationNeeded;

        ba.autoDestroyPrefabs = animation[index].autoDestroyPrefabs;
        ba.prefabName = new string[animation[index].prefabName.Length];
        System.Array.Copy(animation[index].prefabName, ba.prefabName, ba.prefabName.Length);
        for(int i=0; i<ba.prefabName.Length; i++) ba.prefab = ArrayHelper.Add(null, ba.prefab);

        ba.audioName = new string[animation[index].audioName.Length];
        System.Array.Copy(animation[index].audioName, ba.audioName, ba.audioName.Length);
        for(int i=0; i<ba.audioName.Length; i++) ba.audioClip = ArrayHelper.Add(null, ba.audioClip);

        return ba;
    }
示例#2
0
    public override void PlayAnimation(BattleAnimation type)
    {
        if (!isSplit)
        {
            base.PlayAnimation(type);
            return;
        }

        string trigger = "";

        switch (type)
        {
        case BattleAnimation.Attack:
            trigger = "Attack";
            break;

        case BattleAnimation.Hurt:
            trigger = "Hurt";
            break;

        case BattleAnimation.Die:
            trigger = "Die";
            break;
        }

        StartCoroutine(DelayAnimationTrigger(trigger));
    }
示例#3
0
 public override void Execute(BattleAnimation battleAnimation)
 {
     bool finished = false;
     Transform cam = battleAnimation.GetCamera();
     if(cam != null &&
         !battleAnimation.camBlocked &&
         (battleAnimation.IsLatestActiveAction() ||
         !DataHolder.BattleSystem().dynamicCombat))
     {
         CameraEventMover comp = (CameraEventMover)cam.gameObject.GetComponent("CameraEventMover");
         if(comp == null)
         {
             cam.gameObject.AddComponent("CameraEventMover");
             comp = (CameraEventMover)cam.gameObject.GetComponent("CameraEventMover");
         }
         comp.StartCoroutine(comp.SetTargetData(battleAnimation.initialCamPosition, battleAnimation.initialCamRotation,
                 battleAnimation.initialFieldOfView, cam, this.interpolate, this.time));
         if(this.wait)
         {
             finished = true;
             battleAnimation.StartTime(this.time, this.next);
         }
     }
     if(!finished)
     {
         if(this.wait) battleAnimation.StartTime(this.time, this.next);
         else battleAnimation.StepFinished(this.next);
     }
 }
示例#4
0
    public override void Execute(BattleAnimation battleAnimation)
    {
        bool finished = false;

        GameObject[] list = battleAnimation.GetAnimationObjects(this.animationObject, this.prefabID2);
        if(list != null && list.Length > 0)
        {
            for(int i=0; i<list.Length; i++)
            {
                if(list[i] != null && this.pathToChild != "")
                {
                    Transform t = list[i].transform.Find(this.pathToChild);
                    if(t != null) list[i] = t.gameObject;
                }
                if(list[i] != null && this.DoFade(list[i]))
                {
                    finished = true;
                }
            }
        }

        if(this.wait && finished)
        {
            battleAnimation.StartTime(this.time, this.next);
        }
        else
        {
            battleAnimation.StepFinished(this.next);
        }
    }
示例#5
0
 public override void Execute(BattleAnimation battleAnimation)
 {
     if(StatusOrigin.USER.Equals(this.statusOrigin) &&
         battleAnimation.battleAction.user != null &&
         battleAnimation.battleAction.user.prefabInstance != null)
     {
         string name = "";
         if(this.show2)
         {
             name = battleAnimation.battleAction.user.GetAnimationName(this.combatantAnimation);
         }
         else
         {
             name = this.value;
         }
         Animation animation = battleAnimation.battleAction.user.GetAnimationComponent();
         bool play = this.PlayAnimation(animation, name);
         if(this.wait && play)
         {
             battleAnimation.StartTime(AnimationHelper.GetLength(animation, name), this.next);
         }
         else
         {
             battleAnimation.StepFinished(this.next);
         }
     }
     else if(StatusOrigin.TARGET.Equals(this.statusOrigin))
     {
         float t = 0;
         for(int i=0; i<battleAnimation.battleAction.target.Length; i++)
         {
             if(battleAnimation.battleAction.target[i] != null && battleAnimation.battleAction.target[i].prefabInstance != null)
             {
                 string name = "";
                 if(this.show2) name = battleAnimation.battleAction.target[i].GetAnimationName(this.combatantAnimation);
                 else name = this.value;
                 if(this.PlayAnimation(battleAnimation.battleAction.target[i].GetAnimationComponent(), name))
                 {
                     float t2 = AnimationHelper.GetLength(battleAnimation.battleAction.target[i].prefabInstance.animation, name);
                     if(t2 > t)
                     {
                         t = t2;
                     }
                 }
             }
         }
         if(this.wait && t > 0)
         {
             battleAnimation.StartTime(t, this.next);
         }
         else
         {
             battleAnimation.StepFinished(this.next);
         }
     }
     else battleAnimation.StepFinished(this.next);
 }
示例#6
0
    private void Update()
    {
        float l_delta = Time.deltaTime;

        Battle_Singletons._battleActionSelection.update(l_delta);
        Battle_Singletons._battleTargetSelection.update(l_delta);

        SceneGlobalObjects.PlayerTurnInputflow.update(l_delta);

        Battle_Singletons._battleResolutionStep.update(l_delta);

        this.AtbUI.Update(l_delta);

        // Handling damage applied events
        if (Battle_Singletons._battleResolutionStep.Out_DamageApplied_Events.Count > 0)
        {
            for (int i = 0; i < Battle_Singletons._battleResolutionStep.Out_DamageApplied_Events.Count; i++)
            {
                BQEOut_FinalDamageApplied l_event        = Battle_Singletons._battleResolutionStep.Out_DamageApplied_Events[i];
                BattleEntityComponent     l_targetEntity = BattleEntityComponent_Container.ComponentsByHandle[l_event.Target];

                RectTransform l_instanciatedDamageTextObject = GameObject.Instantiate(this.DamageTextPrefab, SceneGlobalObjects.MainCanvas.transform);
                Text          l_instanciatedDamageText       = l_instanciatedDamageTextObject.GetComponentInChildren <Text>();
                l_instanciatedDamageText.text = l_event.FinalDamage.ToString();
                ((RectTransform)l_instanciatedDamageTextObject.transform).position = SceneGlobalObjects.MainCamera.WorldToScreenPoint(l_targetEntity.DamageDisplay_Transform.transform.position);

                BattleAnimation.onDamageReceived(l_targetEntity);
            }
        }

        // On battle entity death
        if (Battle_Singletons._battleResolutionStep.Out_Death_Events.Count > 0)
        {
            for (int i = 0; i < Battle_Singletons._battleResolutionStep.Out_Death_Events.Count; i++)
            {
                BattleEntity          l_deadEntity = Battle_Singletons._battleResolutionStep.Out_Death_Events[i];
                BattleEntityComponent l_destroyedEntityComponent = BattleEntityComponent_Container.ComponentsByHandle[l_deadEntity];

                SceneGlobalObjects.PlayerTurnInputflow.on_battleEntityDeath(l_destroyedEntityComponent);

                //handling selection
                Battle_Singletons._battleActionSelection.on_battleEntityDeath(l_destroyedEntityComponent.BattleEntityHandle);

                //handling target selection
                Battle_Singletons._battleTargetSelection.on_battleEntityDeath(i);

                //We update the BattleTargetSelectionUI is the _battleTargetSelection has changed by taking into account death
                SceneGlobalObjects.BattleTargetSelectionUI.update(Battle_Singletons._battleTargetSelection);

                l_destroyedEntityComponent.Dispose();
            }
            // Battle_Singletons._battleResolutionStep.Out_Death_Events.Clear();
        }

        BattleEntityComponent_Container.Update(l_delta);
    }
示例#7
0
 public void ShowAnimation(BattleAnimation animation, int delay = 0)
 {
     animation.LoadContent();
     animation.WaitDelay = delay;
     lock (_animations)
     {
         _animations.Add(animation);
     }
     animation.Show();
 }
示例#8
0
    public override void Execute(BattleAnimation battleAnimation)
    {
        float t = 0;
        AudioClip[] clip = null;
        if(this.show4)
        {
            if(StatusOrigin.USER.Equals(this.statusOrigin2) && battleAnimation.battleAction.user != null)
            {
                clip = new AudioClip[] {battleAnimation.battleAction.user.GetAudioClip(this.audioID)};
            }
            else if(StatusOrigin.TARGET.Equals(this.statusOrigin2))
            {
                clip = new AudioClip[battleAnimation.battleAction.target.Length];
                for(int i=0; i<battleAnimation.battleAction.target.Length; i++)
                {
                    if(battleAnimation.battleAction.target[i] != null &&
                        battleAnimation.battleAction.target[i].prefabInstance != null)
                    {
                        clip[i] = battleAnimation.battleAction.target[i].GetAudioClip(this.audioID);
                    }
                }
            }
        }
        else clip = new AudioClip[] {battleAnimation.audioClip[this.audioID]};

        bool played = false;
        GameObject[] list = battleAnimation.GetAnimationObjects(this.animationObject, this.prefabID2);
        if(clip != null && clip.Length > 0 &&
            list != null && list.Length > 0)
        {
            for(int i=0; i<list.Length; i++)
            {
                if(list[i] != null && this.pathToChild != "")
                {
                    Transform tr = list[i].transform.Find(this.pathToChild);
                    if(tr != null) list[i] = tr.gameObject;
                }
                if(list[i] != null && i < clip.Length &&
                    this.PlayAudio(list[i], clip[i]))
                {
                    played = true;
                }
            }
        }

        if(played) t = this.MaxClipLength(clip);
        if(wait && t > 0)
        {
            battleAnimation.StartTime(t, this.next);
        }
        else
        {
            battleAnimation.StepFinished(this.next);
        }
    }
示例#9
0
 public override void Execute(BattleAnimation battleAnimation)
 {
     GameObject[] list = battleAnimation.GetAnimationObjects(this.animationObject, this.prefabID2);
     if(list != null && list.Length > 0)
     {
         for(int i=0; i<list.Length; i++)
         {
             if(list[i] != null)
             {
                 list[i].BroadcastMessage(this.key, this.value, SendMessageOptions.DontRequireReceiver);
             }
         }
     }
     battleAnimation.StepFinished(this.next);
 }
示例#10
0
    public static void AddComponentAStep(int index, BattleAnimation battleAnimation, AddComponentAStep baseStep)
    {
        baseStep.fold = EditorGUILayout.Foldout(baseStep.fold, "Step "+index+": Add Component");
        if(baseStep.fold)
        {
            BattleAnimationTabs.AnimationStep(index, battleAnimation, baseStep);
            baseStep.animationObject = (BattleAnimationObject)EditorGUILayout.EnumPopup("Object",
                    baseStep.animationObject, GUILayout.Width(mWidth));
            if(BattleAnimationObject.PREFAB.Equals(baseStep.animationObject))
            {
                baseStep.prefabID2 = EditorGUILayout.IntField("Prefab ID", baseStep.prefabID2, GUILayout.Width(mWidth));
            }
            baseStep.pathToChild = EditorGUILayout.TextField("Path to child", baseStep.pathToChild, GUILayout.Width(mWidth*1.2f));
            EditorGUILayout.Separator();

            baseStep.key = EditorGUILayout.TextField("Component", baseStep.key, GUILayout.Width(mWidth));
            EditorGUILayout.Separator();
        }
    }
示例#11
0
 public override void Execute(BattleAnimation battleAnimation)
 {
     GameObject[] list = battleAnimation.GetAnimationObjects(this.animationObject, this.prefabID2);
     if(list != null && list.Length > 0)
     {
         for(int i=0; i<list.Length; i++)
         {
             if(list[i] != null)
             {
                 if(this.pathToChild != "")
                 {
                     Transform t = list[i].transform.Find(this.pathToChild);
                     if(t != null) list[i] = t.gameObject;
                 }
                 list[i].AddComponent(this.key);
             }
         }
     }
     battleAnimation.StepFinished(this.next);
 }
示例#12
0
    //Make sure this is called on the machine that owns this object: i.e. the LocalAuthority (for players) or the server (for enemies)
    public virtual void PlayAnimation(BattleAnimation type)
    {
        switch (type)
        {
        case BattleAnimation.Attack:
            animator.SetTrigger("Attack");
            break;

        case BattleAnimation.Hurt:
            animator.SetTrigger("Hurt");
            break;

        case BattleAnimation.Die:
            animator.SetTrigger("Die");
            break;

        case BattleAnimation.Revive:
            animator.SetTrigger("Revive");
            break;
        }
    }
示例#13
0
 public override void Execute(BattleAnimation battleAnimation)
 {
     bool finished = false;
     if(this.show7)
     {
         GameHandler.GetLevelHandler().screenFader.FlashScreen(this.show, this.float7, this.float8, this.show2, this.float1, this.float2,
                 this.show4, this.float3, this.float4, this.show5, this.float5, this.float6, this.interpolate, this.time);
     }
     else
     {
         GameHandler.GetLevelHandler().screenFader.FadeScreen(this.show, this.float7, this.float8, this.show2, this.float1, this.float2,
                 this.show4, this.float3, this.float4, this.show5, this.float5, this.float6, this.interpolate, this.time);
     }
     if(this.wait)
     {
         finished = true;
         battleAnimation.StartTime(this.time, this.next);
     }
     if(!finished)
     {
         battleAnimation.StepFinished(this.next);
     }
 }
示例#14
0
    public AnimationStep GetCopy(BattleAnimation battleAnimation)
    {
        AnimationStep s = battleAnimation.TypeToStep(this.type);

        s.fold = this.fold;
        s.next = this.next;
        s.nextFail = this.nextFail;
        s.stepEnabled = this.stepEnabled;

        s.time = this.time;
        s.intensity = this.intensity;
        s.speed = this.speed;
        s.volume = this.volume;
        s.float1 = this.float1;
        s.float2 = this.float2;
        s.float3 = this.float3;
        s.float4 = this.float4;
        s.float5 = this.float5;
        s.float6 = this.float6;
        s.float7 = this.float7;
        s.float8 = this.float8;

        s.actorID = this.actorID;
        s.posID = this.posID;
        s.spawnID = this.spawnID;
        s.min = this.min;
        s.max = this.max;
        s.itemID = this.itemID;
        s.weaponID = this.weaponID;
        s.armorID = this.armorID;
        s.number = this.number;
        s.characterID = this.characterID;
        s.waypointID = this.waypointID;
        s.prefabID = this.prefabID;
        s.prefabID2 = this.prefabID2;
        s.skillID = this.skillID;
        s.audioID = this.audioID;
        s.formulaID = this.formulaID;

        s.wait = this.wait;
        s.useDefault = this.useDefault;
        s.useDefault2 = this.useDefault2;
        s.show = this.show;
        s.show2 = this.show2;
        s.show3 = this.show3;
        s.show4 = this.show4;
        s.show5 = this.show5;
        s.show6 = this.show6;
        s.show7 = this.show7;
        s.showShadow = this.showShadow;
        s.controller = this.controller;

        s.interpolate = this.interpolate;
        s.playMode = this.playMode;
        s.queueMode = this.queueMode;
        s.statusOrigin = this.statusOrigin;
        s.statusOrigin2 = this.statusOrigin2;
        s.combatantAnimation = this.combatantAnimation;
        s.moveToTarget = this.moveToTarget;
        s.audioRolloffMode = this.audioRolloffMode;

        s.rect = this.rect;
        s.rect2 = this.rect2;
        s.v2 = this.v2;
        s.v3 = this.v3;
        s.v3_2 = this.v3_2;
        s.v4 = this.v4;
        s.v4_2 = this.v4_2;

        s.message = new string[this.message.Length];
        System.Array.Copy(this.message, s.message, this.message.Length);
        s.key = this.key;
        s.value = this.value;
        s.effect = new SkillEffect[this.effect.Length];
        System.Array.Copy(this.effect, s.effect, this.effect.Length);

        s.simpleOperator = this.simpleOperator;
        s.valueCheck = this.valueCheck;
        s.animationObject = this.animationObject;

        s.pathToChild = this.pathToChild;

        return s;
    }
示例#15
0
 public virtual void Execute(BattleAnimation battleAnimation)
 {
 }
示例#16
0
    public override void Execute(BattleAnimation battleAnimation)
    {
        bool finished = false;
        Transform cam = battleAnimation.GetCamera();
        GameObject actor = battleAnimation.GetAnimationObject(this.animationObject, this.prefabID);
        if(cam != null && actor != null &&
            !battleAnimation.camBlocked &&
            (battleAnimation.IsLatestActiveAction() ||
            !DataHolder.BattleSystem().dynamicCombat))
        {
            actor = TransformHelper.GetChild(this.pathToChild, actor.transform).gameObject;

            CameraEventMover comp = (CameraEventMover)cam.gameObject.GetComponent("CameraEventMover");
            if(comp == null)
            {
                cam.gameObject.AddComponent("CameraEventMover");
                comp = (CameraEventMover)cam.gameObject.GetComponent("CameraEventMover");
            }
            comp.CameraRotate(cam, actor.transform, this.v3, this.time, this.speed);
            if(this.wait)
            {
                finished = true;
                battleAnimation.StartTime(this.time, this.next);
            }
        }
        if(!finished)
        {
            if(this.wait) battleAnimation.StartTime(this.time, this.next);
            else battleAnimation.StepFinished(this.next);
        }
    }
示例#17
0
 public override void Execute(BattleAnimation battleAnimation)
 {
     if(StatusOrigin.USER.Equals(this.statusOrigin) &&
         battleAnimation.battleAction.user != null &&
         battleAnimation.battleAction.user.prefabInstance != null)
     {
         if(this.show) battleAnimation.battleAction.user.prefabInstance.animation.Stop();
         else
         {
             string name = "";
             if(this.show2)
             {
                 name = battleAnimation.battleAction.user.GetAnimationName(this.combatantAnimation);
             }
             else
             {
                 name = this.value;
             }
             if(name != "") battleAnimation.battleAction.user.prefabInstance.animation.Stop(name);
         }
     }
     else if(StatusOrigin.TARGET.Equals(this.statusOrigin))
     {
         for(int i=0; i<battleAnimation.battleAction.target.Length; i++)
         {
             if(battleAnimation.battleAction.target[i] != null && battleAnimation.battleAction.target[i].prefabInstance != null)
             {
                 if(this.show) battleAnimation.battleAction.target[i].prefabInstance.animation.Stop();
                 else
                 {
                     string name = "";
                     if(this.show2) name = battleAnimation.battleAction.target[i].GetAnimationName(this.combatantAnimation);
                     else name = this.value;
                     if(name != "") battleAnimation.battleAction.target[i].prefabInstance.animation.Stop(name);
                 }
             }
         }
     }
     battleAnimation.StepFinished(this.next);
 }
示例#18
0
 public override void Execute(BattleAnimation battleAnimation)
 {
     battleAnimation.StartTime(this.time, this.next);
 }
示例#19
0
 public override void Execute(BattleAnimation battleAnimation)
 {
     battleAnimation.StepFinished(this.next);
 }
示例#20
0
 public override void Execute(BattleAnimation battleAnimation)
 {
     if(DataHolder.GameSettings().GetRandom() <= this.float1) battleAnimation.StepFinished(this.next);
     else battleAnimation.StepFinished(this.nextFail);
 }
示例#21
0
 public override void Execute(BattleAnimation battleAnimation)
 {
     bool finished = false;
     GameObject actor = null;
     if(this.show3)
     {
         actor = (GameObject)battleAnimation.spawnedPrefabs[this.prefabID];
     }
     else if(battleAnimation.battleAction.user != null && battleAnimation.battleAction.user.prefabInstance != null)
     {
         actor = battleAnimation.battleAction.user.prefabInstance;
     }
     if(actor != null)
     {
         ActorEventMover comp = actor.gameObject.GetComponent<ActorEventMover>();
         if(comp == null)
         {
             comp = actor.gameObject.AddComponent<ActorEventMover>();
         }
         Vector3 target = this.v3;
         if(this.show2) target = actor.transform.TransformDirection(target);
         comp.StartCoroutine(comp.MoveToDirection(actor.transform, this.controller, target, this.show, this.speed, this.time));
         if(this.wait)
         {
             finished = true;
             battleAnimation.StartTime(this.time, this.next);
         }
     }
     if(!finished)
     {
         battleAnimation.StepFinished(this.next);
     }
 }
示例#22
0
 public override void Execute(BattleAnimation battleAnimation)
 {
     Transform cam = battleAnimation.GetCamera();
     GameObject actor = battleAnimation.GetAnimationObject(this.animationObject, this.prefabID);
     if(cam != null && actor != null &&
         !battleAnimation.camBlocked &&
         (battleAnimation.IsLatestActiveAction() ||
         !DataHolder.BattleSystem().dynamicCombat))
     {
         DataHolder.CameraPosition(this.posID).Use(cam, actor.transform);
     }
     battleAnimation.StepFinished(this.next);
 }
示例#23
0
 public override void Execute(BattleAnimation battleAnimation)
 {
     if(!battleAnimation.camBlocked &&
         (battleAnimation.IsLatestActiveAction() ||
         !DataHolder.BattleSystem().dynamicCombat))
     {
         battleAnimation.ResetCameraPosition();
     }
     battleAnimation.StepFinished(this.next);
 }
示例#24
0
    public void AnimationFinished()
    {
        // set last skill
        if(user != null)
        {
            if(this.IsSkill()) user.lastSkill = this.useID;
            else user.lastSkill = -1;

            // battle animation callbacks
            if(this.IsDeath()) user.Died();
            else if(this.IsAttack()) user.NextBaseAttack();

            if(!DataHolder.BattleSystem().IsRealTime() &&
                doCounter != null && doCounter.Length == target.Length)
            {
                for(int i=0; i<target.Length; i++)
                {
                    if(doCounter[i] && !target[i].IsInAction())
                    {
                        DataHolder.BattleSystem().UnshiftAction(new BattleAction(AttackSelection.COUNTER, target[i], user.battleID, -1, 0));
                    }
                }
            }
        }

        if(this.activeAnimation != null) this.activeAnimation.battleAction = null;
        this.activeAnimation = null;
        if(DataHolder.BattleSystem().IsActiveTime() && user != null &&
            !user.isDead && !this.IsCounter() && !this.autoAttackFlag)
        {
            user.timeBar -= this.GetTimeUse();
            user.usedTimeBar -= this.GetTimeUse();
            if(user.usedTimeBar < 0) user.usedTimeBar = 0;
            if(user.timeBar >= DataHolder.BattleSystem().maxTimebar)
            {
                user.timeBar = DataHolder.BattleSystem().maxTimebar-0.1f;
            }
        }

        if(user != null)
        {
            user.SetInAction(false);
            user.NextAction();
        }
        DataHolder.BattleSystem().RemoveActiveAction(this);
        DataHolder.BattleSystem().CheckDeath();
        if(!DataHolder.BattleSystem().dynamicCombat)
        {
            DataHolder.BattleSystem().ActionFinished();
        }
    }
示例#25
0
    /*
    ============================================================================
    Action performing functions
    ============================================================================
    */
    public void PerformAction()
    {
        DataHolder.BattleSystem().AddActiveAction(this);

        // init targets
        this.target = this.GetTargets(true);

        if(!DataHolder.BattleSystem().IsRealTime() && this.user != null &&
            (target.Length == 0 || (target.Length == 1 &&
            (target[0] == null || (target[0].isDead && !this.reviveFlag)))) &&
            (this.IsAttack() || (this.IsSkill() && DataHolder.Skill(this.useID).TargetSingleEnemy()) ||
            (this.IsItem() && DataHolder.Item(this.useID).TargetSingleEnemy())))
        {
            if((this.user is Character && !this.user.IsAttackFriends()) ||
                (this.user is Enemy && this.user.IsAttackFriends()))
            {
                target = new Combatant[] {DataHolder.BattleSystem().GetCombatantForBattleID(
                        user.GetRandomTarget(DataHolder.BattleSystem().enemies))};
            }
            else if((this.user is Character && this.user.IsAttackFriends()) ||
                (this.user is Enemy && !this.user.IsAttackFriends()))
            {
                target = new Combatant[] {DataHolder.BattleSystem().GetCombatantForBattleID(
                        user.GetRandomTarget(GameHandler.Party().GetBattleParty()))};
            }
        }

        if(!this.IsNone() && user != null &&
            (DataHolder.BattleSystem().IsRealTime() ||
            (target.Length > 0 && target[0] != null)) &&
            ((!user.isDead && !this.IsDeath()) || this.IsDeath()))
        {
            for(int i=0; i<this.target.Length; i++)
            {
                if(this.target[i] != null && !this.user.SameType(this.target[i]))
                {
                    this.target[i].CheckAggressive(AggressiveType.ACTION);
                }
            }

            if(this.IsCounter()) user.baIndex = 0;
            user.lastTargetBattleID = this.targetID;
            user.SetInAction(true);
            if(DataHolder.BattleCam().blockAnimationCams &&
                user.prefabInstance != null)
            {
                DataHolder.BattleCam().SetLatestUser(user.prefabInstance.transform);
            }
            if(Application.isPlaying)
            {
                // show info
                if(DataHolder.BattleSystemData().showInfo)
                {
                    if(this.IsSkill() && DataHolder.BattleSystemData().showSkills)
                    {
                        GameHandler.GetLevelHandler().ShowBattleInfo(
                                DataHolder.GameSettings().GetSkillLevelName(DataHolder.Skills().GetName(this.useID), this.useLevel+1),
                                DataHolder.BattleSystemData().infoPosition);
                    }
                    else if(this.IsItem() && DataHolder.BattleSystemData().showItems)
                    {
                        GameHandler.GetLevelHandler().ShowBattleInfo(DataHolder.Items().GetName(this.useID),
                                DataHolder.BattleSystemData().infoPosition);
                    }
                    else if(this.IsDefend() && DataHolder.BattleSystemData().showDefend)
                    {
                        GameHandler.GetLevelHandler().ShowBattleInfo(DataHolder.BattleMenu().defendName[GameHandler.GetLanguage()] as string,
                                DataHolder.BattleSystemData().infoPosition);
                    }
                    else if(this.IsEscape() && DataHolder.BattleSystemData().showEscape)
                    {
                        GameHandler.GetLevelHandler().ShowBattleInfo(DataHolder.BattleMenu().escapeName[GameHandler.GetLanguage()] as string,
                                DataHolder.BattleSystemData().infoPosition);
                    }
                    else if(this.IsCounter() && DataHolder.BattleSystemData().showCounter)
                    {
                        GameHandler.GetLevelHandler().ShowBattleInfo(DataHolder.BattleSystemData().GetCounterText(),
                                DataHolder.BattleSystemData().infoPosition);
                    }
                }
                // get battle animation
                if((this.IsAttack() || this.IsCounter()))
                {
                    int id = user.GetBaseAttackAnimation();
                    if(id >= 0) this.activeAnimation = DataHolder.BattleAnimations().GetCopy(id);
                }
                else if(this.IsSkill())
                {
                    if(this.target == null || this.target.Length == 0)
                    {
                        DataHolder.Skill(this.useID).UserConsume(this.user, this.useLevel);
                        this.userConsumeDone = true;
                    }
                    if(DataHolder.Skill(this.useID).level[this.useLevel].battleAnimation)
                    {
                        this.activeAnimation = DataHolder.BattleAnimations().GetCopy(DataHolder.Skill(this.useID).level[this.useLevel].animationID);
                    }
                }
                else if(this.IsItem() && DataHolder.Item(this.useID).battleAnimation)
                {
                    this.activeAnimation = DataHolder.BattleAnimations().GetCopy(DataHolder.Item(this.useID).animationID);
                }
                else if(this.IsDefend() && user.battleAnimations.animateDefend)
                {
                    this.activeAnimation = DataHolder.BattleAnimations().GetCopy(user.GetDefendAnimation());
                }
                else if(this.IsEscape() && user.battleAnimations.animateEscape)
                {
                    this.activeAnimation = DataHolder.BattleAnimations().GetCopy(user.GetEscapeAnimation());
                }
                else if(this.IsDeath() && user.battleAnimations.animateDeath)
                {
                    this.activeAnimation = DataHolder.BattleAnimations().GetCopy(user.GetDeathAnimation());
                }
            }

            if(this.activeAnimation != null)
            {
                this.activeAnimation.StartEvent(this);
            }
            else
            {
                if(target != null && target.Length > 0)
                {
                    this.Calculate(target, 1);
                }
                this.AnimationFinished();
            }
        }
        else
        {
            this.AnimationFinished();
        }
    }
示例#26
0
 public override void Execute(BattleAnimation battleAnimation)
 {
     bool finished = false;
     Transform cam = battleAnimation.GetCamera();
     if(cam != null &&
         !battleAnimation.camBlocked &&
         (battleAnimation.IsLatestActiveAction() ||
         !DataHolder.BattleSystem().dynamicCombat))
     {
         CameraEventMover comp = (CameraEventMover)cam.gameObject.GetComponent("CameraEventMover");
         if(comp == null)
         {
             cam.gameObject.AddComponent("CameraEventMover");
             comp = (CameraEventMover)cam.gameObject.GetComponent("CameraEventMover");
         }
         comp.CameraShake(cam, this.time, this.intensity, this.speed);
         if(this.wait)
         {
             finished = true;
             battleAnimation.StartTime(this.time, this.next);
         }
     }
     if(!finished)
     {
         if(this.wait) battleAnimation.StartTime(this.time, this.next);
         else battleAnimation.StepFinished(this.next);
     }
 }
示例#27
0
 public override void Execute(BattleAnimation battleAnimation)
 {
     int difID = GameHandler.GetDifficulty();
     if((ValueCheck.EQUALS.Equals(this.valueCheck) && difID == this.number) ||
         (ValueCheck.LESS.Equals(this.valueCheck) && difID < this.number) ||
         (ValueCheck.GREATER.Equals(this.valueCheck) && difID > this.number))
     {
         battleAnimation.StepFinished(this.next);
     }
     else
     {
         battleAnimation.StepFinished(this.nextFail);
     }
 }
示例#28
0
 public override void Execute(BattleAnimation battleAnimation)
 {
     Character c = GameHandler.Party().GetCharacter(this.characterID);
     if(c != null)
     {
         if(DataHolder.GameSettings().GetRandom() <= DataHolder.Formula(this.formulaID).Calculate(c, c)) battleAnimation.StepFinished(this.next);
         else battleAnimation.StepFinished(this.nextFail);
     }
     else battleAnimation.StepFinished(this.nextFail);
 }
示例#29
0
    public override void Execute(BattleAnimation battleAnimation)
    {
        bool finished = false;
        GameObject actor = null;
        if(this.show3)
        {
            actor = (GameObject)battleAnimation.spawnedPrefabs[this.prefabID];
        }
        else if(battleAnimation.battleAction.user != null && battleAnimation.battleAction.user.prefabInstance != null)
        {
            actor = battleAnimation.battleAction.user.prefabInstance;
        }

        GameObject target = null;
        if(this.show7)
        {
            target = (GameObject)battleAnimation.spawnedPrefabs[this.number];
        }
        else if(BattleMoveToTarget.TARGET.Equals(this.moveToTarget) &&
            battleAnimation.battleAction.target != null &&
            battleAnimation.battleAction.target.Length > 0)
        {
            if(battleAnimation.battleAction.target.Length == 1 &&
                battleAnimation.battleAction.target[0] != null &&
                battleAnimation.battleAction.target[0].prefabInstance != null)
            {
                target = battleAnimation.battleAction.target[0].prefabInstance;
            }
            else if(battleAnimation.battleAction.target.Length > 1)
            {
                target = DataHolder.BattleSystem().GetGroupCenter(battleAnimation.battleAction.target);
            }
        }
        else if(BattleMoveToTarget.BASE.Equals(this.moveToTarget))
        {
            target = battleAnimation.battleAction.user.GetBattleSpot().gameObject;
        }
        else if(BattleMoveToTarget.CENTER.Equals(this.moveToTarget))
        {
            target = DataHolder.BattleSystem().GetArenaCenter();
        }

        if(actor != null && target != null)
        {
            if(this.pathToChild != "")
            {
                Transform t = target.transform.Find(this.pathToChild);
                if(t != null) target = t.gameObject;
            }

            ActorEventMover comp = actor.gameObject.GetComponent<ActorEventMover>();
            if(comp == null)
            {
                comp = actor.gameObject.AddComponent<ActorEventMover>();
            }

            // move by speed
            if(this.show5)
            {
                float sp = this.speed;
                if(this.show6) sp = battleAnimation.battleAction.user.GetMoveSpeed();
                float d = 0;
                if(this.show4) d = this.float1;
                comp.StartCoroutine(comp.SpeedToObject(actor.transform, this.controller, this.show2,
                        sp, d, target.transform, this.wait ? battleAnimation : null, this.next));
                if(this.wait) finished = true;
            }
            // move by interpolation
            else
            {
                if(this.show4)
                {
                    float distanceLength = Vector3.Distance(actor.transform.position, target.transform.position);
                    GameObject obj = new GameObject();
                    obj.transform.position = target.transform.position;
                    target = obj;
                    target.transform.position = Vector3.Lerp(target.transform.position, actor.transform.position, this.float1 / distanceLength);
                }
                comp.StartCoroutine(comp.MoveToObject(actor.transform, this.controller, this.show2, this.show,
                        target.transform, this.interpolate, this.time));
                if(this.wait)
                {
                    finished = true;
                    battleAnimation.StartTime(this.time, this.next);
                }
            }
        }
        if(!finished)
        {
            battleAnimation.StepFinished(this.next);
        }
    }
示例#30
0
 public override void Execute(BattleAnimation battleAnimation)
 {
     if((this.show && battleAnimation.battleAction.user is Character) ||
         (!this.show && battleAnimation.battleAction.user is Enemy))
     {
         battleAnimation.StepFinished(this.next);
     }
     else
     {
         battleAnimation.StepFinished(this.nextFail);
     }
 }
示例#31
0
    public override void Execute(BattleAnimation battleAnimation)
    {
        GameObject actor = battleAnimation.GetAnimationObject(this.animationObject, this.prefabID2);

        GameObject target = null;
        if(BattleMoveToTarget.TARGET.Equals(this.moveToTarget) &&
            battleAnimation.battleAction.target != null &&
            battleAnimation.battleAction.target.Length > 0)
        {
            target = DataHolder.BattleSystem().GetGroupCenter(battleAnimation.battleAction.target);
        }
        else if(BattleMoveToTarget.BASE.Equals(this.moveToTarget))
        {
            target = battleAnimation.battleAction.user.GetBattleSpot().gameObject;
        }
        else if(BattleMoveToTarget.CENTER.Equals(this.moveToTarget))
        {
            target = DataHolder.BattleSystem().GetArenaCenter();
        }

        if(actor != null && target != null)
        {
            if(this.pathToChild != "")
            {
                Transform t = target.transform.Find(this.pathToChild);
                if(t != null) target = t.gameObject;
            }
            actor.transform.position = target.transform.position+this.v3;
        }
        battleAnimation.StepFinished(this.next);
    }
示例#32
0
 public override void Execute(BattleAnimation battleAnimation)
 {
     battleAnimation.StepFinished(Random.Range(this.min, this.max+1));
 }
示例#33
0
 public void ShowAnimationAndWait(BattleAnimation animation, int delay = 0)
 {
     ShowAnimation(animation, delay);
     WaitForAnimations();
 }
示例#34
0
 public override void Execute(BattleAnimation battleAnimation)
 {
     if(this.show && battleAnimation.battleAction.user is Enemy)
     {
         battleAnimation.StartTime(this.time, this.nextFail);
     }
     else
     {
         battleAnimation.WaitForButton(this.key, this.time, this.next, this.nextFail);
     }
 }
示例#35
0
 public override void Execute(BattleAnimation battleAnimation)
 {
     battleAnimation.CallAnimation(this.number, this.next);
 }