Beispiel #1
0
 // Use this for initialization
 void Start()
 {
     line      = FindObjectOfType <LineRenderer>();
     WhiteBall = FindObjectOfType <WhiteBall>();
     Text.text = "Hits: " + Hits;
     balls     = FindObjectsOfType <NormalBall>();
 }
Beispiel #2
0
 private void Awake()
 {
     instance       = this;
     rigid          = GetComponent <Rigidbody>();
     rigid.velocity = Vector3.zero;
     yellowBall     = FindObjectOfType <YellowBall>();
     redBall        = FindObjectOfType <RedBall>();
 }
Beispiel #3
0
 // Start is called before the first frame update
 void Awake()
 {
     battente        = GameObject.Find("Battente").transform;
     camera          = CameraController.getInstance();
     ball            = battente.GetComponent <WhiteBall>();
     line            = GetComponent <LineRenderer>();
     line.startWidth = 0.01f;
     line.endWidth   = 0.01f;
 }
Beispiel #4
0
 void Awake()
 {
     bball    = Resources.Load <BlueBall>("BlueWarrior");
     wball    = Resources.Load <WhiteBall>("WhiteWarrior");
     panel    = transform.Find("Panel").gameObject;
     square   = Resources.Load <Square>("Square");
     triangle = Resources.Load <Triangle>("Triangle");
     star     = Resources.Load <Star>("Star");
 }
Beispiel #5
0
 void Start()
 {
     line       = GameObject.FindGameObjectWithTag("apuntador").gameObject.GetComponent <LineRenderer>();
     WhiteBall  = FindObjectOfType <WhiteBall>();
     Text.text  = "Jugador 1: " + PuntosP1;
     Text2.text = "Jugador 2: " + PuntosP2;
     balls      = FindObjectsOfType <NormalBall>();
     goals      = FindObjectsOfType <goal>();
     turno      = true;
     gradient   = new Gradient();
     gradient.SetKeys(
         new GradientColorKey[] { new GradientColorKey(Jugador1, 0.0f), new GradientColorKey(Jugador1, 1.0f) },
         new GradientAlphaKey[] { new GradientAlphaKey(alpha, 0.0f), new GradientAlphaKey(alpha, 1.0f) }
         );
     line.gameObject.GetComponent <LineRenderer>().colorGradient = gradient;
     dibujarLineas();
 }
Beispiel #6
0
    public void CreateWarriors()
    {
        BlueBall bball_1 = Instantiate(bball, new Vector3(-6.5f, 3.5f, 0f), Quaternion.identity) as BlueBall;
        BlueBall bball_2 = Instantiate(bball, new Vector3(-3f, 0f, 0f), Quaternion.identity) as BlueBall;
        BlueBall bball_3 = Instantiate(bball, new Vector3(-6.5f, -3.5f, 0f), Quaternion.identity) as BlueBall;

        WhiteBall wball_1 = Instantiate(wball, new Vector3(6.5f, 3.5f, 0f), Quaternion.identity) as WhiteBall;
        WhiteBall wball_2 = Instantiate(wball, new Vector3(3f, 0f, 0f), Quaternion.identity) as WhiteBall;
        WhiteBall wball_3 = Instantiate(wball, new Vector3(6.5f, -3.5f, 0f), Quaternion.identity) as WhiteBall;

        foreach (var warrior in new GameObject[] { bball_1.gameObject, bball_2.gameObject, bball_3.gameObject, wball_1.gameObject, wball_2.gameObject, wball_3.gameObject })
        {
            AddExtensions(warrior);
            jiEst++;
            jiEst = jiEst % 3;
        }
    }
Beispiel #7
0
        public void Init(WhiteBall whiteBall, Field field, InputManager inputManager, Animations animations)
        {
            _whiteBall = whiteBall;
            _field     = field;

            _inputManager = inputManager;
            _animations   = animations;

            _cuePeak.position       = _whiteBall.gameObject.transform.position;
            _currentCuePosition     = _cue.position;
            _currentCuePeakRotation = _cuePeak.eulerAngles;

            inputManager.OnTouchDown += SetTouchDownData;
            _onTouchDrag              = inputManager.OnTouchDrag += position =>
            {
                Move(position);
                Rotate(position);
            };
            inputManager.OnTouchUp += Hit;

            _onBallsStopped = _field.OnBallsStopped += _ => AlignWithWhiteBall();

            _whiteBall.OnReset += AlignWithWhiteBall;
        }
Beispiel #8
0
 public void Init(Ball[] allBalls, WhiteBall whiteBall, InputManager inputManager)
 {
     _allBalls     = allBalls;
     _whiteBall    = whiteBall;
     _inputManager = inputManager;
 }
Beispiel #9
0
 public DragOperation()
 {
     cueBall    = Pools.CueBall;
     constraint = Pools.CueBall.GetComponent <Constraint>();
 }
 public ShotBall(WhiteBall ball)
 {
     this.ball = ball;
     this.launchTime = Time.time;
 }
 public DragOperation()
 {
     cueBall = Pools.CueBall;
     constraint = Pools.CueBall.GetComponent<Constraint>();
 }