Exemplo n.º 1
0
 private void Awake()
 {
     courtManager    = GetComponent <CourtManager>();
     pointManager    = GetComponent <PointManager>();
     soundManager    = GetComponent <SoundManager>();
     replayManager   = GetComponent <ReplayManager>();
     tennisVariables = GetComponent <TennisVariables>();
 }
Exemplo n.º 2
0
 /// <summary>
 /// Constructor
 /// </summary>
 public BallPhysics(float radius, float bounciness, float grndY, SoundManager sndManager, PointManager pointManager, TennisVariables tv)
 {
     this.radius     = radius;
     this.bounciness = bounciness;
     this.groundY    = grndY;
     _pointManager   = pointManager;
     _soundManager   = sndManager;
     _tv             = tv;
 }
Exemplo n.º 3
0
 public BallPhysics(BallPhysics ballPhysics)
 {
     radius            = ballPhysics.radius;
     bounciness        = ballPhysics.bounciness;
     groundY           = ballPhysics.groundY;
     _pointManager     = ballPhysics._pointManager;
     _soundManager     = ballPhysics._soundManager;
     _tv               = ballPhysics._tv;
     _isPredictionBall = true; // Constructor only called in this case
 }
Exemplo n.º 4
0
    void Start()
    {
        _courtManager  = gameManager.courtManager;
        _pointManager  = gameManager.pointManager;
        _soundManager  = gameManager.soundManager;
        _replayManager = gameManager.replayManager;
        _tv            = gameManager.tennisVariables;

        CalculateAnimatorHashes();

        //InitTechniqueAttrs();
    }
Exemplo n.º 5
0
    void Start()
    {
        var gameManager = GameObject.FindWithTag("GameController").GetComponent <GameManager>();

        _pointManager  = gameManager.pointManager;
        _soundManager  = gameManager.soundManager;
        _replayManager = gameManager.replayManager;
        _tv            = gameManager.tennisVariables;
        _player1       = gameManager.player;
        _player2       = gameManager.aiPlayer;

        bounciness         = _tv.BallBounciness;
        _netBounceCoef     = _tv.NetBounceFrictionMultiplier;
        _defaultBounceCoef = _tv.DefaultBounceFrictionMultiplier;

        ballInfo.Position = transform.position;

        ballPhysics = new BallPhysics(Radius, bounciness, ground.position.y, _soundManager, _pointManager, _tv);

        _netLayer    = LayerMask.NameToLayer("Net");
        _groundLayer = LayerMask.NameToLayer("Ground");
    }
Exemplo n.º 6
0
    void Start()
    {
        _courtManager  = gameManager.courtManager;
        _pointManager  = gameManager.pointManager;
        _soundManager  = gameManager.soundManager;
        _replayManager = gameManager.replayManager;
        _tv            = gameManager.tennisVariables;

        switch (_difficulty)
        {
        case Difficulty.Easy:
            _maxReactionTime       = _tv.MaxReactionTimeEasy;
            _volleyModeProbability = _tv.AIVolleyModeProbabilityEasy;
            _speed = _tv.AISpeedEasy;
            break;

        case Difficulty.Normal:
            _maxReactionTime       = _tv.MaxReactionTimeNormal;
            _volleyModeProbability = _tv.AIVolleyModeProbabilityNormal;
            _speed = _tv.AISpeedNormal;
            break;

        case Difficulty.Hard:
            _maxReactionTime       = _tv.MaxReactionTimeHard;
            _volleyModeProbability = _tv.AIVolleyModeProbabilityHard;
            _speed = _tv.AISpeedHard;
            break;

        default:
            throw new ArgumentOutOfRangeException();
        }

        CalculateAnimatorHashes();

        _reactionWaitTimer = Random.Range(0f, (_volleyModeActivated? 0.5f : 1) * _maxReactionTime);
        _backCenter        = new Vector3(39.75f, -3.067426f, 0);
    }