Exemplo n.º 1
0
    public IEnumerator ExecuteCombat()
    {
        defenseQueue.Clear();
        Animating = true;
        List <Animatable> deadOnes = new List <Animatable>();

        for (int i = 0; i < enemyLogics.Count; i++)
        {
            enemyLogics[i].EnterCombat();
        }
        while (animQueue.Length() > 0)
        {
            yield return(new WaitForSeconds(1));

            AnimationBean currentSet = animQueue.Next();
            if (currentSet.Win == WIN)
            {
                deadOnes.Add(currentSet.animatable);
            }
            else
            {
                deadOnes.Add(playerController);
            }
            RunAnimation(currentSet);
        }
        yield return(new WaitForSeconds(1.5f));

        AnimateDeaths(deadOnes);
        yield return(new WaitForSeconds(1));

        ExitCombat();
    }
Exemplo n.º 2
0
 public AnimationBean Next()
 {
     if (animQueue.Count > 0)
     {
         AnimationBean firstItem = animQueue[0];
         animQueue.RemoveAt(0);
         return(firstItem);
     }
     else
     {
         throw new System.Exception("Animation Queue is empty!");
     }
 }
Exemplo n.º 3
0
    private void RunAnimation(AnimationBean anim)
    {
        //Get a unit vector pointing from the anim to the player.
        Vector3 playerPos = player.transform.position;
        Vector3 animPos   = anim.animatable.transform.position;
        Vector3 dirVec    = playerPos - animPos;

        dirVec /= dirVec.magnitude;

        //remove the indicator
        Destroy(anim.animatable.gameObject.GetComponent <LineRenderer>());
        if (anim.CharAttack == "Parry")
        {
            //anim.SetTrigger("isParry");
            //run parry animation here
        }
        else if (anim.CharAttack == "Feint")
        {
            Vector3 tempPos = CheckAboveFloor(animPos + dirVec);
            StartCoroutine(MoveAtoB(tempPos, player, 100f));
            //player.transform.position = tempPos;
        }
        else if (anim.CharAttack == "Slash")
        {
            Vector3 tempPos = CheckAboveFloor(animPos - dirVec);
            StartCoroutine(MoveAtoB(tempPos, player, 100f));
        }
        if (anim.EnemyAttack == "Parry")
        {
        }
        else if (anim.EnemyAttack == "Feint")
        {
            Vector3 tempPos = CheckAboveFloor(playerPos - dirVec);
            StartCoroutine(MoveAtoB(tempPos, anim.animatable.gameObject, 100f));
        }
        else if (anim.EnemyAttack == "Slash")
        {
            Vector3 tempPos = CheckAboveFloor(playerPos + dirVec);
            StartCoroutine(MoveAtoB(tempPos, anim.animatable.gameObject, 100f));
        }
    }
Exemplo n.º 4
0
    private void RunAnimation(AnimationBean anim)
    {
        //Get a unit vector pointing from the anim to the player.
        Vector3 playerPos = player.transform.position;
        Vector3 enemyPos  = anim.Enemy.transform.position;
        Vector3 dirVec    = playerPos - enemyPos;

        dirVec /= dirVec.magnitude;

        //remove the indicator
        Destroy(anim.Enemy.gameObject.GetComponent <LineRenderer>());
        if (anim.CharAttack == "Parry")
        {
            playerController.Parry(anim.Enemy);
        }
        else if (anim.CharAttack == "Feint")
        {
            playerController.Feint(anim.Enemy);
        }
        else if (anim.CharAttack == "Slash")
        {
            playerController.Slash(anim.Enemy);
        }
        if (anim.EnemyAttack == "Parry")
        {
            playerController.Parry(playerController);
        }
        else if (anim.EnemyAttack == "Feint")
        {
            anim.Enemy.Feint(playerController);
        }
        else if (anim.EnemyAttack == "Slash")
        {
            anim.Enemy.Slash(playerController);
        }
    }
Exemplo n.º 5
0
 public void Add(AnimationBean animSet)
 {
     animQueue.Add(animSet);
 }