Exemplo n.º 1
0
 public string GetAnimationState(bool isFull)
 {
     if (isFull)
     {
         return(StanceState.ToString() + ActionState.ToString() + MotionState.ToString() + DirectionState.ToString());
     }
     else
     {
         return(((int)StanceState).ToString() + ((int)ActionState).ToString() + ((int)MotionState).ToString() + ((int)DirectionState).ToString());
     }
 }
Exemplo n.º 2
0
    void Rules()
    {
        Debug.Log("Player uses " + playerCurrentAction.ToString() + " and Enemy uses " + enemyCurrentAction.ToString());
        if (enemyCurrentAction == ActionStates.IDLE && playerCurrentAction == ActionStates.IDLE)
        {
            Debug.Log(PointsManager(false, false, 0));
        }
        if ((enemyCurrentAction == ActionStates.QUICK_ATTACK ||
             enemyCurrentAction == ActionStates.SPELL
             ) && playerCurrentAction == ActionStates.IDLE)
        {
            Debug.Log(PointsManager(false, true, 1));
        }


        if (enemyCurrentAction == ActionStates.QUICK_ATTACK && playerCurrentAction == ActionStates.BLOCK)
        {
            Debug.Log(PointsManager(true, false, 1));
        }
        if (enemyCurrentAction == ActionStates.SPELL && playerCurrentAction == ActionStates.BLOCK)
        {
            Debug.Log(PointsManager(false, true, 1));
        }
        if (enemyCurrentAction == ActionStates.BLOCK && playerCurrentAction == ActionStates.BLOCK)
        {
            Debug.Log(PointsManager(false, false, 0));
        }

        if (enemyCurrentAction == ActionStates.QUICK_ATTACK && playerCurrentAction == ActionStates.QUICK_ATTACK)
        {
            Debug.Log(PointsManager(false, false, 0));
        }
        if (enemyCurrentAction == ActionStates.SPELL && playerCurrentAction == ActionStates.QUICK_ATTACK)
        {
            Debug.Log(PointsManager(true, false, 1));
        }
        if (enemyCurrentAction == ActionStates.BLOCK && playerCurrentAction == ActionStates.QUICK_ATTACK)
        {
            Debug.Log(PointsManager(false, true, 1));
        }

        if (enemyCurrentAction == ActionStates.QUICK_ATTACK && playerCurrentAction == ActionStates.SPELL)
        {
            Debug.Log(PointsManager(false, true, 1));
        }
        if (enemyCurrentAction == ActionStates.SPELL && playerCurrentAction == ActionStates.SPELL)
        {
            Debug.Log(PointsManager(false, false, 0));
        }
        if (enemyCurrentAction == ActionStates.BLOCK && playerCurrentAction == ActionStates.SPELL)
        {
            Debug.Log(PointsManager(true, false, 1));
        }
    }
Exemplo n.º 3
0
 public void ExecuteAction(ActionStates state)
 {
     Debug.Log("Execute Action:" + state.ToString());
     if (state == ActionStates.QUICK_ATTACK)
     {
         StartCoroutine(executeAction("IsAttack", false));
     }
     else if (state == ActionStates.BLOCK)
     {
         StartCoroutine(executeAction("IsBlock", false));
     }
     else if (state == ActionStates.SPELL)
     {
         StartCoroutine(executeAction("IsSpell", true));
     }
 }
Exemplo n.º 4
0
 public void SetCondition(ActionStates con)
 {
     condition   = con;
     upText.text = "if <" + con.ToString() + ">";
 }
Exemplo n.º 5
0
 public void ExecuteAction(ActionStates state)
 {
     Debug.Log("Execute Action:" + state.ToString());
 }
Exemplo n.º 6
0
    IEnumerator simulation(int totalCount)
    {
        bool EndFight = false;

        //fillPlayerActions.UpdateCanvas();
        yield return(new WaitForSeconds(.5f));

        PlayerPointerObject.gameObject.SetActive(true);
        EnemyPointerObject.gameObject.SetActive(true);
        Debug.Log("Going to fight!");
        battlecount = 0;
        while (!bossStats.IsDead() || !playerStats.IsDead())
        {
            battlecount++;
            Debug.Log("Combat sequence:" + battlecount);
            for (int i = 0; i < totalCount; i++)
            {
                playerCurrentAction = CBM.PlayerActions[i];
                enemyCurrentAction  = EnemyActions[i];

                if (EnemyScriptCase.childCount >= i + 1)
                {
                    EnemyBlockPos = EnemyScriptCase.GetChild(i);
                }

                if (PlayerScriptCase.childCount >= i + 1)
                {
                    PlayerBlockPos = PlayerScriptCase.GetChild(i);
                }


                yield return(new WaitForSeconds(.5f));

                Debug.Log("EAS:" + enemyCurrentAction.ToString());
                EAS.ExecuteAction(enemyCurrentAction);
                PAS.ExecuteAction(playerCurrentAction);
                Rules();
                if (bossStats.IsDead() || playerStats.IsDead())
                {
                    EndFight = true;
                }


                yield return(new WaitForSeconds(3f));

                if (EndFight)
                {
                    break;
                }



                //check here if someone is dead
            }
            if (EndFight)
            {
                break;
            }
            if (/*(bossStats.currentHealth == playerStats.currentHealth) || */ (bossStats.currentHealth == bossStats.maxHealth && playerStats.currentHealth == playerStats.maxHealth))
            {
                Modal.ShowOk("The combat is concluding to a tie. Reasses your code blocks!", () => StopAll(), "Oops!");
                DebugMode();
                break;
            }
            yield return(new WaitForSeconds(.05f));
        }
        Debug.Log("end fight!");

        ////check here if player and enemy life is equal if yes declare a tie
        ////if life is not equal repeat sequence
        //AddtoConsole("Player:" + PlayerPoints + " points");
        //AddtoConsole("Enemy:" + EnemyPoints + " points");
        //Debug.Log("Player:" + PlayerPoints + " points");
        //Debug.Log("Enemy:" + EnemyPoints + " points");
        //if (PlayerPoints > EnemyPoints)
        //{
        //    Debug.Log("PLAYER WINS!");
        //    AddtoConsole("Player wins!");
        //}
        //else if (PlayerPoints < EnemyPoints)
        //{
        //    DebugMode();
        //    Debug.Log("ENEMY WINS!");
        //    AddtoConsole("Enemy Wins!");
        //}
        //else
        //{
        //    DebugMode();
        //    AddtoConsole("Its a tie");
        //    }
        AddtoConsole("End of Simulation");

        PlayerPointerObject.gameObject.SetActive(false);
        EnemyPointerObject.gameObject.SetActive(false);
        IsCompiling  = false;
        IsSimulating = false;

        yield return(new WaitForSeconds(7f));

        if (bossStats.IsDead())
        {
            Debug.Log("Used " + CBM.blockUsed.Count + " blocks");
            WinSum.blockUsed = CBM.blockUsed.Count;
            WinSum.IsPerfect = (playerStats.currentHealth >= playerStats.maxHealth);
            WinSum.ShowWin();
        }
    }