// HANDLE THE COLLISION HERE
    void OnTriggerEnter2D(Collider2D other)
    {
    	if (!lost)
    	{
            global.winner = false;
            results.SetActive(true);
            ballMovement ballScript = other.GetComponent<ballMovement>();
	    	int dir = ballScript.dir;

	        if (other.gameObject.tag == "ball")
	    	{
	    		Destroy(other.gameObject);
	    		if (dir == 0)
	    			pos += Vector3.up * 2;
	            else if (dir == 1)
	            {
	            	if (pos.y == -3)
	            		pos += Vector3.down * 3;
	            	else
	            		pos += Vector3.down * 2;
	            }
	            else if (dir == 2)
	            	pos += Vector3.right * 2;
	            else
	            	pos += Vector3.left * 2;
	        }
    	}
    }
 // Start is called before the first frame update
 void Start()
 {
     ball        = GameObject.FindObjectOfType <ballMovement>();
     height      = GetComponent <SpriteRenderer>().sprite.bounds.size.y;
     downMost    = Camera.main.ViewportToWorldPoint(new Vector3(0, 0, 0));
     upMost      = Camera.main.ViewportToWorldPoint(new Vector3(1, 1, 0));
     downMost.y += height;
     upMost.y   -= height;
 }
Exemple #3
0
    // Use this for initialization
    void Start()
    {
        ballMvt = transform.GetComponent <ballMovement>();

        //colors[0] = new Color(109,79,0);
        //colors[1] = Color.red;
        //colors[2] = Color.yellow;
        //colors[3] = new Color(255,130,0);
        //colors[4] = Color.blue;
        //colors[5] = Color.magenta;
    }
Exemple #4
0
    // Use this for initialization
    void Start()
    {
        particlesScript = transform.GetComponent <particlesGeneration>();
        ballMvtScript   = GetComponent <ballMovement>();

        numberOfGoldChickenFound = 0;
        particles.startColor     = particlesScript.colors[numberOfGoldChickenFound];

        godChickenSpotlights = GameObject.FindGameObjectsWithTag("chicken_god spotlight");

        foreach (GameObject spotlight in godChickenSpotlights)
        {
            spotlight.light.enabled = false;
        }
    }
Exemple #5
0
 // Use this for initialization
 void Start()
 {
     rb             = GetComponent <Rigidbody>();
     movement       = GetComponent <ballMovement>();
     marbleCollider = GetComponent <SphereCollider>();
 }
Exemple #6
0
 // Use this for initialization
 void Start()
 {
     ballMovementScript = ballTransform.GetComponent <ballMovement>();
     wind = GetComponent <AudioSource>();
 }