Ejemplo n.º 1
0
 void FixedUpdate()
 {
     if (!statusController.IsDead() && !enemyAI.isPerformingAction)
     {
         Move();
     }
     else if (statusController.IsDead())
     {
         rb.simulated = false;
     }
 }
Ejemplo n.º 2
0
    IEnumerator AttackSequence()
    {
        message = "Good luck, make you sure kill them all!";
        yield return(StartCoroutine(MessageController.controller.StartDisplayMessage(message, 2f)));

        for (int i = 0; i < numberOfEnemies; i++)
        {
            enemyObject.SetupEnemy();
            yield return(StartCoroutine(SingleMatch()));

            message = (player.IsDead() ? gameOverMessages[UnityEngine.Random.Range(0, winningMessages.Length)] : winningMessages[UnityEngine.Random.Range(0, winningMessages.Length)]);
            yield return(StartCoroutine(MessageController.controller.StartDisplayMessage(message, 2f)));
        }
        message = "Here's How It Went Down" + Environment.NewLine + "Battles: " + enemyCount + Environment.NewLine + "Wins: " + winCount + Environment.NewLine + "Awesome score: " + winCount * 1f / enemyCount * 1f;
        yield return(StartCoroutine(MessageController.controller.StartDisplayMessage(message, 10f)));
    }
Ejemplo n.º 3
0
    IEnumerator SingleMatch()
    {
        enemyCount++;
        playerTurn = true;
        while (!player.IsDead() && !target.IsDead())
        {
            if (playerTurn)
            {
                // Let player choose action
                Debug.Log("Player turn");
                playerObject.playerLight.TurnOn();
                playerObject.OpenMenu();
                enemyObject.playerLight.TurnOff();
                yield return(StartCoroutine(playerObject.WaitForAction()));
            }
            else
            {
                Debug.Log("Enemy turn");
                enemyObject.playerLight.TurnOn();
                enemyObject.OpenMenu();
                playerObject.playerLight.TurnOff();
                yield return(new WaitForSeconds(attackTime / 2f));

                enemyObject.Attack(AttackType.Attack1, true);
            }
            yield return(new WaitForSeconds(attackTime / 2f));

            playerTurn = !playerTurn;
            //Take turns attacking
        }

        if (!player.IsDead())
        {
            winCount++;
            player.ResetHealth();
            target.ResetHealth();
        }
        else
        {
            //TODO death :)
        }
        yield return(null);
    }