Exemplo n.º 1
0
    protected virtual void Awake()
    {
        OriginalParent    = transform.parent;
        Team              = _team;
        xzController      = GetComponent <PlayerMover>();
        ballUserComponent = GetComponent <BallUserComponent>();
        StartCoroutine(DashRoutine());

        if (grabHitbox == null)
        {
            Debug.LogError("SmallPlayer.grabHitbox is null.  HMMMM  <_<");
        }
    }
Exemplo n.º 2
0
    public GameObject OpponentBasketFromTeam(ScoreComponent.PlayerType team)
    {
        switch (team)
        {
        case ScoreComponent.PlayerType.team1:
            return(basket2);

        case ScoreComponent.PlayerType.team2:
            return(basket1);

        default:
            string errorMessage = "Undefined enum value";
            Debug.LogError(errorMessage);
            throw new System.Exception(errorMessage);
        }
    }
Exemplo n.º 3
0
    //Scoring, to be called from player script
    public void UpdateScore(ScoreComponent.PlayerType p, int i)
    {
        Ball.SetParent(null);
        SoundManager.Instance.Play(scoreSound);

        //Everyone releases the ball
        SmallPlayer1.HoldBall(null);
        SmallPlayer2.HoldBall(null);
        TallPlayer1.HoldBall(null);
        TallPlayer2.HoldBall(null);

        //Reset everyone's position
        ResetAfterScore();

        //Team who didn't score gets the ball
        if (p == ScoreComponent.PlayerType.team1)
        {
            ScoreTeam1 += i;
            SmallPlayer1.HoldBall(Ball);
            _ball.transform.localPosition = Vector3.zero;
        }
        else
        {
            ScoreTeam2 += i;
            SmallPlayer2.HoldBall(Ball);
            _ball.transform.localPosition = Vector3.zero;
        }

        //Tell GUI to update the scores
        MainGameGUI.S.UpdateScores(p);

        //End the game if we were in overtime
        if (State == Overtime)
        {
            EndGame();
        }
    }