Beispiel #1
0
        void Awake()
        {
            _game  = FindObjectOfType <PongGame>();
            _speed = 5f;
            //_velocity = new Vector3(-1, Random.Range(-1f, 1f)).normalized * _speed; //random angle
            _velocity           = new Vector3(-1, angles.Random().First()).normalized *_speed; //random angle from set
            transform.position += new Vector3(9, Random.Range(-6f, 6f));                       //random posistion
            //transform.position += new Vector3(9, 0);  //fixed posistion - use when using fixed angles sequence?
            var pcs = FindObjectsOfType <PongController>();

            Player1 = pcs.First(pc => pc.Side == Player.Player1);
            Player2 = pcs.First(pc => pc.Side == Player.Player2);
        }
Beispiel #2
0
 void Start()
 {
     _controller = GetComponent <PongController>();
     _ball       = FindObjectOfType <PongBall>();
 }