Exemplo n.º 1
0
 void _SetShotScale(GameManager.ShotTypes ballType)
 {
     // substate machine for ball types and their respective power scalars
     if (ballType == GameManager.ShotTypes.BASEBALL ||
         ballType == GameManager.ShotTypes.FOOTBALL)
     {
         shotScale = 25;
     }
     else
     if (ballType == GameManager.ShotTypes.FRISBEE ||
         ballType == GameManager.ShotTypes.SOCCERBALL)
     {
         shotScale = 20;
     }
     else
     if (ballType == GameManager.ShotTypes.NERFFOOTBALL)
     {
         shotScale = 22.5f;
     }
     else
     if (ballType == GameManager.ShotTypes.TENNISBALL ||
         ballType == GameManager.ShotTypes.VOLLEYBALL ||
         ballType == GameManager.ShotTypes.HOCKEYPUCK)
     {
         shotScale = 17.5f;
     }
 }
    public void UseShot()
    {
        if (selectedShot == GameManager.ShotTypes.BASEBALL)
        {
            baseball.sprite = used;
        }
        else
        if (selectedShot == GameManager.ShotTypes.FOOTBALL)
        {
            football.sprite = used;
        }
        else
        if (selectedShot == GameManager.ShotTypes.FRISBEE)
        {
            frisbee.sprite = used;
        }
        else
        if (selectedShot == GameManager.ShotTypes.HOCKEYPUCK)
        {
            hockey.sprite = used;
        }
        else
        if (selectedShot == GameManager.ShotTypes.NERFFOOTBALL)
        {
            nerf.sprite = used;
        }
        else
        if (selectedShot == GameManager.ShotTypes.SOCCERBALL)
        {
            soccer.sprite = used;
        }
        else
        if (selectedShot == GameManager.ShotTypes.TENNISBALL)
        {
            tennis.sprite = used;
        }
        else
        if (selectedShot == GameManager.ShotTypes.VOLLEYBALL)
        {
            volleyball.sprite = used;
        }

        selectedShot = GameManager.ShotTypes.UNSELECTED;
    }
Exemplo n.º 3
0
 void _SetBall(GameManager.ShotTypes ballType)
 {
     if (ballType == GameManager.ShotTypes.BASEBALL)
     {
         activeBall = Baseball;
     }
     else
     if (ballType == GameManager.ShotTypes.FOOTBALL)
     {
         activeBall = Football;
     }
     else
     if (ballType == GameManager.ShotTypes.NERFFOOTBALL)
     {
         activeBall = NerfFootball;
     }
     else
     if (ballType == GameManager.ShotTypes.FRISBEE)
     {
         activeBall = Frisbee;
     }
     else
     if (ballType == GameManager.ShotTypes.HOCKEYPUCK)
     {
         activeBall = HockeyPuck;
     }
     else
     if (ballType == GameManager.ShotTypes.SOCCERBALL)
     {
         activeBall = Soccerball;
     }
     else
     if (ballType == GameManager.ShotTypes.TENNISBALL)
     {
         activeBall = TennisBall;
     }
     else
     if (ballType == GameManager.ShotTypes.VOLLEYBALL)
     {
         activeBall = Volleyball;
     }
 }
    public void ChangeSelection(GameManager.ShotTypes newShot)
    {
        if (selectedShot != GameManager.ShotTypes.UNSELECTED)
        {
            if (selectedShot == GameManager.ShotTypes.BASEBALL)
            {
                baseball.sprite = _baseball;
            }
            else
            if (selectedShot == GameManager.ShotTypes.FOOTBALL)
            {
                football.sprite = _football;
            }
            else
            if (selectedShot == GameManager.ShotTypes.FRISBEE)
            {
                frisbee.sprite = _frisbee;
            }
            else
            if (selectedShot == GameManager.ShotTypes.HOCKEYPUCK)
            {
                hockey.sprite = _hockey;
            }
            else
            if (selectedShot == GameManager.ShotTypes.NERFFOOTBALL)
            {
                nerf.sprite = _nerf;
            }
            else
            if (selectedShot == GameManager.ShotTypes.SOCCERBALL)
            {
                soccer.sprite = _soccer;
            }
            else
            if (selectedShot == GameManager.ShotTypes.TENNISBALL)
            {
                tennis.sprite = _tennis;
            }
            else
            if (selectedShot == GameManager.ShotTypes.VOLLEYBALL)
            {
                volleyball.sprite = _volleyball;
            }
        }

        selectedShot = newShot;
        if (selectedShot == GameManager.ShotTypes.BASEBALL)
        {
            baseball.sprite = selected;
        }
        else
        if (selectedShot == GameManager.ShotTypes.FOOTBALL)
        {
            football.sprite = selected;
        }
        else
        if (selectedShot == GameManager.ShotTypes.FRISBEE)
        {
            frisbee.sprite = selected;
        }
        else
        if (selectedShot == GameManager.ShotTypes.HOCKEYPUCK)
        {
            hockey.sprite = selected;
        }
        else
        if (selectedShot == GameManager.ShotTypes.NERFFOOTBALL)
        {
            nerf.sprite = selected;
        }
        else
        if (selectedShot == GameManager.ShotTypes.SOCCERBALL)
        {
            soccer.sprite = selected;
        }
        else
        if (selectedShot == GameManager.ShotTypes.TENNISBALL)
        {
            tennis.sprite = selected;
        }
        else
        if (selectedShot == GameManager.ShotTypes.VOLLEYBALL)
        {
            volleyball.sprite = selected;
        }
    }
Exemplo n.º 5
0
 public void ShootBall(float power, float angle, float startingX, float startingY, GameManager.ShotTypes ballType)
 {
     _SetBall(ballType);
     _SetShotScale(ballType);
     liveBall    = Instantiate(activeBall, new Vector2(startingX, startingY), Quaternion.identity) as GameObject;
     rb          = liveBall.GetComponent <Rigidbody2D>();
     rb.velocity = new Vector2(Mathf.Cos(angle * Mathf.Deg2Rad) * power * shotScale,
                               Mathf.Sin(angle * Mathf.Deg2Rad) * power * shotScale);
 }