예제 #1
0
    public void AnimationSetup()
    {
        if (MoveCo != null)
        {
            StopCoroutine(MoveCo);
        }
        ResetPos();
        CharacterAnimationStateType nextAnim = (CharacterAnimationStateType)Enum.Parse(typeof(CharacterAnimationStateType), AnimToUse.options[AnimToUse.value].text);

        CurrentSpeed = 1 * AnimationSpeed.value;
        currentCharacter.SpineAnim.SetAnimationSpeed(CurrentSpeed);
        currentCharacter.CharInfo.BaseSpeed = CurrentSpeed;
        if (nextAnim.ToString().Contains("Atk"))
        {
            currentCharacter.GetAttack();
        }

        if (nextAnim.ToString().Contains("Dash"))
        {
            MoveCo = MoveChar((InputDirection)Enum.Parse(typeof(InputDirection), nextAnim.ToString().Substring(4)));
            StartCoroutine(MoveCo);
            return;
        }
        currentCharacter.SpineAnim.SetAnim(nextAnim, Loop.isOn, TransitionTime.value);
    }
예제 #2
0
    public override void SetAnimation(CharacterAnimationStateType animState, bool loop = false, float transition = 0)
    {
        Debug.Log(animState.ToString());
        SpineAnim.AnimationTransition = 1;
        switch (animState)
        {
        case (CharacterAnimationStateType.Idle):
            transition = 0.5f;
            break;

        case (CharacterAnimationStateType.Atk1_IdleToAtk):
            transition = 0f;
            break;

        case (CharacterAnimationStateType.Idle_Disable_Loop):
            transition = 1f;
            break;

        case (CharacterAnimationStateType.Death_Prep):
            transition = 1f;
            break;

        case (CharacterAnimationStateType.Atk1_AtkToIdle):
            transition = 0.5f;
            break;

        case (CharacterAnimationStateType.Atk1_Charging):
            transition = 0.4f;
            break;

        default:
            break;
        }
        base.SetAnimation(animState, loop, transition);
    }
예제 #3
0
 public override void SetAnimation(CharacterAnimationStateType animState, bool loop = false, float transition = 0)
 {
     foreach (MinionType_Script piece in Pieces)
     {
         piece.SetAnimation(animState, loop, transition);
     }
 }
예제 #4
0
 public float GetAnimLenght(CharacterAnimationStateType anim)
 {
     if (skeletonAnimation.Skeleton.Data.FindAnimation(anim.ToString()) != null)
     {
         return(skeletonAnimation.Skeleton.Data.FindAnimation(anim.ToString()).Duration);
     }
     return(1);
 }
예제 #5
0
 public override void SetAnimation(CharacterAnimationStateType animState, bool loop = false, float transition = 0)
 {
     if (animState.ToString().Contains("Dash"))
     {
         animState = CharacterAnimationStateType.Idle;
         loop      = true;
     }
     base.SetAnimation(animState, loop, transition);
 }
예제 #6
0
    public override void SetAnimation(CharacterAnimationStateType animState, bool loop = false, float transition = 0)
    {
        switch (animState)
        {
        case (CharacterAnimationStateType.Idle):
            transition = 0.2f;
            bossLady.SetAnimation(CharacterAnimationStateType.Idle, loop, transition);
            break;

        case (CharacterAnimationStateType.Atk1_IdleToAtk):
            transition = 0f;
            bossLady.SetAnimation(CharacterAnimationStateType.Idle_IdleToAtk, loop, transition);
            break;

        case (CharacterAnimationStateType.Idle_Disable_Loop):
            transition = 0.2f;
            bossLady.SetAnimation(CharacterAnimationStateType.Idle_Disable_Loop, loop, transition);
            break;

        case (CharacterAnimationStateType.Death_Prep):
            transition = 0.1f;
            bossLady.SetAnimation(CharacterAnimationStateType.Death_Prep, loop, transition);
            break;

        case (CharacterAnimationStateType.Atk1_AtkToIdle):
            transition = 0.3f;
            bossLady.SetAnimation(CharacterAnimationStateType.Idle_AtkToIdle, loop, transition);
            break;

        case (CharacterAnimationStateType.Atk1_Charging):
            transition = 0.1f;
            bossLady.SetAnimation(CharacterAnimationStateType.Idle_Charging, loop, transition);
            break;

        case (CharacterAnimationStateType.GettingHit):
            transition = 0.2f;
            bossLady.SetAnimation(CharacterAnimationStateType.GettingHit, loop, transition);
            break;

        case (CharacterAnimationStateType.Atk1_Loop):
            transition = 0.1f;
            bossLady.SetAnimation(CharacterAnimationStateType.Idle_Loop, loop, transition);
            break;

        default:
            break;
        }

        if (animState != CharacterAnimationStateType.Death_Exit && SpineAnim.CurrentAnim == CharacterAnimationStateType.Idle_Disable_Loop.ToString())
        {
            return;
        }

        base.SetAnimation(animState, loop, transition);
    }
예제 #7
0
    public void SetAnim(CharacterAnimationStateType anim, bool loop, float transition)
    {
        if (anim == CharacterAnimationStateType.Atk1_IdleToAtk)
        {
            //Debug.Log("Arriving start");
        }
        Loop = loop;
        //Debug.Log(anim.ToString());

        SpineAnimationState.SetAnimation(0, anim.ToString(), loop).MixDuration = transition;
        //StartCoroutine(ClearAnim(transition));
        CurrentAnim = anim.ToString();
    }
예제 #8
0
    public override void SetUpEnteringOnBattle()
    {
        CharacterAnimationStateType animType = (CharacterAnimationStateType)System.Enum.Parse(typeof(CharacterAnimationStateType), CharacterAnimationStateType.Growing.ToString() + Random.Range(1, 3).ToString());

        SetAnimation(animType);
        StartCoroutine(base.MoveByTileSpeed(GridManagerScript.Instance.GetBattleTile(UMS.Pos[0]).transform.position, SpineAnim.CurveType == MovementCurveType.Space_Time ? SpineAnim.Space_Time_Curves.UpMovement : SpineAnim.Speed_Time_Curves.UpMovement, SpineAnim.GetAnimLenght(animType)));
        Skin newSkin = new Skin("new-skin");                                  // 1. Create a new empty skin

        newSkin.AddSkin(SpineAnim.skeleton.Data.FindSkin(mfType.ToString())); // 2. Add items
        SpineAnim.skeleton.SetSkin(mfType.ToString());
        SpineAnim.skeleton.SetSlotsToSetupPose();
        SpineAnim.SpineAnimationState.Apply(SpineAnim.skeleton);
    }
예제 #9
0
    public override void SetAnimation(CharacterAnimationStateType animState, bool loop = false, float transition = 0)
    {
        switch (animState)
        {
        case (CharacterAnimationStateType.Idle):
            transition = 0.3f;
            break;

        default:
            break;
        }
        base.SetAnimation(animState, loop, transition);
    }
예제 #10
0
    public void SetAnim(CharacterAnimationStateType anim)
    {
        if (CurrentAnim == CharacterAnimationStateType.Death.ToString() && anim.ToString() != CharacterAnimationStateType.Idle.ToString())
        {
            return;
        }

        if (anim == CharacterAnimationStateType.Arriving || anim.ToString().Contains("Growing"))
        {
            SetAnim(anim, false, 0);
        }
        else
        {
            SetAnim(anim, anim == CharacterAnimationStateType.Death || anim == CharacterAnimationStateType.Idle ? true : false, AnimationTransition);
        }
    }
예제 #11
0
 public override void SetAnimation(CharacterAnimationStateType animState, bool loop = false, float transition = 0)
 {
     SetAnimation(animState.ToString(), loop, transition);
 }
예제 #12
0
    IEnumerator GridLeapSequence(float duration, Vector3 translation, bool moveChars = true)
    {
        //Ensure new grid is set and moved to correct position before everything
        jumpingchars.Clear();
        float jumpHeight = 2f;
        CharacterAnimationStateType jumpAnim = CharacterAnimationStateType.DashUp;

        Vector3         cameraStartPos = MainCamera.transform.position;
        CameraInfoClass cic            = CameraStage.CameraInfo.Where(r => r.StageIndex == currentGridIndex && !r.used).First();

        Vector3 cameraOffsetChange = cic.CameraPosition - CameraManagerScript.Instance.CurrentCameraOffset;
        float   cameraStartOrtho   = MainCamera.orthographicSize;
        float   cameraEndOrtho     = cic.OrthographicSize;

        cic.used = true;
        //DONT FORGET TO ADD CAMERA OFFSET ADJUSTMENT
        if (moveChars)
        {
            chars = System.Array.ConvertAll(BattleManagerScript.Instance.AllCharactersOnField.Where(r => r.IsOnField).ToArray(), item => (CharacterType_Script)item);
        }
        else
        {
            chars = new CharacterType_Script[0];
        }
        Vector3[] charStartPositions = new Vector3[chars != null ? chars.Length : 0];
        Vector3[] charGridPosOffsets = new Vector3[chars != null ? chars.Length : 0];
        for (int i = 0; i < (chars != null ? chars.Length : 0); i++)
        {
            charStartPositions[i] = chars[i].transform.position;
            BattleTileScript bts = GridManagerScript.Instance.BattleTiles.Where(r => r.Pos == chars[i].UMS.CurrentTilePos).FirstOrDefault();
            if (bts.BattleTileState != BattleTileStateType.Empty ||
                chars[i].UMS.WalkingSide != bts.WalkingSide)
            {
                BattleTileScript newGridTile = GridManagerScript.Instance.GetRandomFreeAdjacentTile(chars[i].UMS.CurrentTilePos, 5, false, chars[i].UMS.WalkingSide);
                Debug.Log(newGridTile.Pos);
                charGridPosOffsets[i] = GridManagerScript.GetTranslationBetweenTiles(GridManagerScript.Instance.BattleTiles.Where(r => r.Pos == chars[i].UMS.CurrentTilePos).First(), newGridTile);
                GridManagerScript.Instance.SetBattleTileState(newGridTile.Pos, BattleTileStateType.Occupied);
                chars[i].CurrentBattleTiles = new List <BattleTileScript>()
                {
                    newGridTile
                };
                chars[i].UMS.CurrentTilePos = newGridTile.Pos;
                chars[i].UMS.Pos            = new List <Vector2Int>()
                {
                    newGridTile.Pos
                };
            }
            else
            {
                GridManagerScript.Instance.SetBattleTileState(bts.Pos, BattleTileStateType.Occupied);
                charGridPosOffsets[i] = Vector3.zero;
            }
            chars[i].SetAttackReady(false);

            if (translation == Vector3.zero && charGridPosOffsets[i] == Vector3.zero)
            {
                continue;
            }
            jumpingchars.Add(chars[i]);
            chars[i].SetAnimation(jumpAnim);
        }

        float timeRemaining = duration;
        float progress      = 0;
        float xPos          = 0f;
        float yPos          = 0f;
        bool  hasStarted    = false;

        while (timeRemaining != 0 || !hasStarted)
        {
            hasStarted    = true;
            timeRemaining = Mathf.Clamp(timeRemaining - Time.deltaTime, 0f, 9999f);
            progress      = 1f - (timeRemaining / (duration != 0f ? duration : 1f));

            MainCamera.transform.position = Vector3.Lerp(cameraStartPos, cameraStartPos + translation + cameraOffsetChange, UniversalGameBalancer.Instance.cameraTravelCurve.Evaluate(progress));
            MainCamera.orthographicSize   = Mathf.Lerp(cameraStartOrtho, cameraEndOrtho, progress);


            for (int i = 0; i < (jumpingchars != null ? jumpingchars.Count : 0); i++)
            {
                xPos  = Mathf.Lerp(charStartPositions[i].x, charStartPositions[i].x + translation.x + charGridPosOffsets[i].x, UniversalGameBalancer.Instance.cameraTravelCurve.Evaluate(progress));
                yPos  = Mathf.Lerp(charStartPositions[i].y, charStartPositions[i].y + translation.y + charGridPosOffsets[i].y, UniversalGameBalancer.Instance.cameraTravelCurve.Evaluate(progress));
                yPos += jumpHeight * UniversalGameBalancer.Instance.characterJumpCurve.Evaluate(progress);
                jumpingchars[i].transform.position = new Vector3(xPos, yPos, jumpingchars[i].transform.position.z);
                jumpingchars[i].SpineAnim.SetAnimationSpeed(UniversalGameBalancer.Instance.jumpAnimationCurve.Evaluate(progress));
            }
            yield return(null);
        }
        CameraManagerScript.Instance.CurrentCameraOffset = cic.CameraPosition;

        if (chars.Length != 0)
        {
            foreach (CharacterType_Script character in BattleManagerScript.Instance.PlayerControlledCharacters)
            {
                character.SetAttackReady(true);
            }
        }
    }
예제 #13
0
    IEnumerator MoveCharactersToFitNewGridSequence(float duration)
    {
        float jumpHeight = 2f;
        CharacterAnimationStateType jumpAnim = CharacterAnimationStateType.DashUp;

        CharacterType_Script[]      chars       = BattleManagerScript.Instance.PlayerControlledCharacters;
        List <CharacterType_Script> charsToMove = new List <CharacterType_Script>();
        List <Vector3> charStartPositions       = new List <Vector3>();
        List <Vector3> charGridPosOffsets       = new List <Vector3>();

        for (int i = 0; i < (chars != null ? chars.Length : 0); i++)
        {
            if (GridManagerScript.Instance.BattleTiles.Where(r => r.Pos == chars[i].UMS.CurrentTilePos).FirstOrDefault().BattleTileState == BattleTileStateType.Blocked ||
                GridManagerScript.Instance.BattleTiles.Where(r => r.Pos == chars[i].UMS.CurrentTilePos).FirstOrDefault().WalkingSide != chars[i].UMS.WalkingSide)
            {
                BattleTileScript newGridTile = GridManagerScript.Instance.GetRandomFreeAdjacentTile(chars[i].UMS.CurrentTilePos, 5, false, chars[i].UMS.WalkingSide);
                GridManagerScript.Instance.SetBattleTileState(newGridTile.Pos, BattleTileStateType.Occupied);

                charsToMove.Add(chars[i]);
                charStartPositions.Add(chars[i].transform.position);
                charGridPosOffsets.Add(GridManagerScript.GetTranslationBetweenTiles(GridManagerScript.Instance.BattleTiles.Where(r => r.Pos == chars[i].UMS.CurrentTilePos).First(), newGridTile));

                chars[i].CurrentBattleTiles = new List <BattleTileScript>()
                {
                    newGridTile
                };
                chars[i].UMS.CurrentTilePos = newGridTile.Pos;
                chars[i].UMS.Pos            = new List <Vector2Int>()
                {
                    newGridTile.Pos
                };

                chars[i].SetAnimation(jumpAnim);
            }
            chars[i].SetAttackReady(false);
        }

        float timeRemaining = duration;
        float progress      = 0;
        float xPos          = 0f;
        float yPos          = 0f;
        bool  hasStarted    = false;

        while (timeRemaining != 0 || !hasStarted)
        {
            hasStarted    = true;
            timeRemaining = Mathf.Clamp(timeRemaining - Time.deltaTime, 0f, 9999f);
            progress      = 1f - (timeRemaining / (duration != 0f ? duration : 1f));

            for (int i = 0; i < (charsToMove != null ? charsToMove.Count : 0); i++)
            {
                xPos  = Mathf.Lerp(charStartPositions[i].x, charStartPositions[i].x + charGridPosOffsets[i].x, UniversalGameBalancer.Instance.cameraTravelCurve.Evaluate(progress));
                yPos  = Mathf.Lerp(charStartPositions[i].y, charStartPositions[i].y + charGridPosOffsets[i].y, UniversalGameBalancer.Instance.cameraTravelCurve.Evaluate(progress));
                yPos += jumpHeight * UniversalGameBalancer.Instance.characterJumpCurve.Evaluate(progress);
                charsToMove[i].transform.position = new Vector3(xPos, yPos, charsToMove[i].transform.position.z);
                charsToMove[i].SpineAnim.SetAnimationSpeed(UniversalGameBalancer.Instance.jumpAnimationCurve.Evaluate(progress));
            }
            yield return(null);
        }
        if (chars != null)
        {
            foreach (CharacterType_Script character in chars)
            {
                character.SetAttackReady(true);
            }
        }
    }
예제 #14
0
    //Basic attack sequence
    public override IEnumerator AttackSequence(ScriptableObjectAttackBase atk = null)
    {
        /*shotsLeftInAttack = 0;
         * if (currentAttackPhase != AttackPhasesType.End) yield break;*/

        //yield return null;
        Attacking = true;

        CharacterAnimationStateType animToFire = CharacterAnimationStateType.Atk1_IdleToAtk;
        bool isLooped = false;

        if (atk != null)
        {
            nextAttack = atk;
        }
        else
        {
            GetAttack();
        }
        if (nextAttack != null)
        {
            switch (nextAttack.AttackAnim)
            {
            /*  case AttackAnimPrefixType.Atk:
             *    sequencedAttacker = false;
             *    chargeParticles = ParticleManagerScript.Instance.FireParticlesInPosition(CharInfo.ParticleID, AttackParticlePhaseTypes.Charging, transform.position, UMS.Side);
             *    animToFire = CharacterAnimationStateType.Idle;
             *    isLooped = true;
             *    currentAttackPhase = AttackPhasesType.Cast_Powerful;
             *    CreateTileAttack();
             *    break;*/
            case AttackAnimType.Weak_Atk:
                animToFire = CharacterAnimationStateType.Atk1_IdleToAtk;
                isLooped   = false;
                break;

            case AttackAnimType.Strong_Atk:
                animToFire = CharacterAnimationStateType.Atk2_IdleToAtk;
                isLooped   = false;
                break;

            case AttackAnimType.Buff:
                break;

            case AttackAnimType.Debuff:
                break;
            }

            /*  switch (CurrentAI)
             * {
             *    case AIType.GeneralAI:
             *        res = GeneralTestAI();
             *        break;
             *    case AIType.AggressiveAI:
             *        res = AggressiveTestAI();
             *        break;
             * }*/
            //shotsLeftInAttack = GetHowManyAttackAreOnBattleField(((ScriptableObjectAttackTypeOnBattlefield)nextAttack).BulletTrajectories);

            currentAttackPhase = AttackPhasesType.Start;
            SetAnimation(animToFire, isLooped, 0f);


            while (Attacking)
            {
                yield return(null);
            }
        }
    }