Exemplo n.º 1
0
    public override IEnumerator UsePowerup(GameObject player)
    {
        int activatorPosition = gameManager.GetPositionByPlayer(player.GetComponent <Transform>());

        int targetPosition = activatorPosition - 1;

        if (targetPosition == 0)
        {
            targetPosition = 2;
        }

        Transform targetPlayer = gameManager.GetPlayerByPosition(targetPosition);

        PlayerStats ps = player.GetComponent <PlayerStats>();

        ps.UsedPowerup();

        CarController targetCarController = targetPlayer.GetComponent <CarController>();

        targetCarController.steeringReversed = true;

        yield return(new WaitForSeconds(DURATION));

        targetCarController.steeringReversed = false;
    }
Exemplo n.º 2
0
    private Transform GetPlayerToAttack(Transform ownPlayer)
    {
        int ownPosition = gameManager.GetPositionByPlayer(ownPlayer);

        if (ownPosition == 1)
        {
            return(gameManager.GetPlayerByPosition(2));
        }
        else
        {
            return(gameManager.GetPlayerByPosition(ownPosition - 1));
        }
    }
Exemplo n.º 3
0
    public override IEnumerator UsePowerup(GameObject player)
    {
        int activatorPosition = gameManager.GetPositionByPlayer(player.GetComponent <Transform>());

        PlayerStats aps = player.GetComponent <PlayerStats>();

        int targetPosition = activatorPosition - 1;

        if (targetPosition == 0)
        {
            targetPosition = 2;
        }

        Transform targetPlayer = gameManager.GetPlayerByPosition(targetPosition);

        PlayerStats ps = player.GetComponent <PlayerStats>();

        ps.UsedPowerup();

        CarController targetCarController = targetPlayer.GetComponent <CarController>();

        PlayerStats tps = targetPlayer.GetComponent <PlayerStats>();

        if (!tps.hasShield)
        {
            yield return(new WaitForSeconds(DELAY));

            tps.StartReverseSteer();
            targetCarController.steeringReversed = true;
            tps.hasShield = false;
        }
        tps.StopShield();

        if (aps.hasWhiteBrick)
        {
            yield return(new WaitForSeconds(WHITE_BRICK_DURATION));
        }
        else
        {
            yield return(new WaitForSeconds(DURATION));
        }

        targetCarController.steeringReversed = false;
        tps.StopReverseSteer();
    }
Exemplo n.º 4
0
 private void setPlaces()
 {
     gameManager_E.secondPlace = gameManager_E.GetPositionByPlayer(gameManager_E.carTransformList[1]);
     gameManager_E.thirdPlace  = gameManager_E.GetPositionByPlayer(gameManager_E.carTransformList[2]);
     gameManager_E.fourthPlace = gameManager_E.GetPositionByPlayer(gameManager_E.carTransformList[3]);
 }