Пример #1
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))
     {
         CameraEventMover comp = (CameraEventMover)cam.gameObject.GetComponent("CameraEventMover");
         if(comp == null)
         {
             cam.gameObject.AddComponent("CameraEventMover");
             comp = (CameraEventMover)cam.gameObject.GetComponent("CameraEventMover");
         }
         comp.StartCoroutine(comp.SetTargetData(DataHolder.CameraPosition(this.posID), cam, actor.transform, 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);
     }
 }
Пример #2
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);
 }
Пример #3
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);
        }
    }
Пример #4
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);
     }
 }
Пример #5
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);
     }
 }
Пример #6
0
 public override void Execute(BattleAnimation battleAnimation)
 {
     battleAnimation.StartTime(this.time, this.next);
 }
Пример #7
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);
        }
    }
Пример #8
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);
     }
 }
Пример #9
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);
        }
    }
Пример #10
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);
     }
 }
Пример #11
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);
        }
    }