예제 #1
0
    private Transform GetPlayerToAttack(Transform ownPlayer)
    {
        int ownPosition = gameManager.GetPositionByPlayer(ownPlayer);

        if (ownPosition == 1)
        {
            return(gameManager.GetPlayerByPosition(2));
        }
        else
        {
            return(gameManager.GetPlayerByPosition(ownPosition - 1));
        }
    }
예제 #2
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;
    }
예제 #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();
    }