Пример #1
0
 void Start()
 {
     falcon = gameObject.GetComponent <Rigidbody>();
     GetComponent <BoxCollider>().enabled = false;
     falcon.useGravity = false;
     moving            = true;
     pos = new Vector3(target.position.x + 5, target.position.y + 10, -1f);
     transform.position = pos; //sets the position of the falcon
     turningPoint       = new Vector3(-20f, 20f, -1f);
     falconSpeed        = 5f;
     falcon.AddForce(-2f, -2f, 0f);
     foxScript = FindObjectOfType <FoxScript>(); // returns the pobject that matches
 }
Пример #2
0
    void Start()
    {
        bugButton[0] = GameObject.Find("yellow").GetComponent <Button>();
        bugButton[0].onClick.AddListener(yellowDecrease);

        bugButton[1] = GameObject.Find("blue").GetComponent <Button>();
        bugButton[1].onClick.AddListener(blueDecrease);

        bugButton[2] = GameObject.Find("green").GetComponent <Button>();
        bugButton[2].onClick.AddListener(greenDecrease);

        bugButton[3] = GameObject.Find("red").GetComponent <Button>();
        bugButton[3].onClick.AddListener(redDecrease);

        foxScript = FindObjectOfType <FoxScript>();
    }