// Update is called once per frame void Update() { birdPos.x = this.transform.position.x; birdPos.y = this.transform.position.y; if (killBird) { flyAwayBird(); } if (cropDestroyed) { crowRenderer.sprite = sprFlying; flyAwayBird(); } else { if (!killBird && !targetedLand.getLandStatus()) { selectedIndex = Random.Range(0, potentialTargets.Length); target = potentialTargets[selectedIndex].transform; targetedLand = target.gameObject.GetComponent <FertileLand>(); flyAwayBird(); } if (!killBird && targetedLand.getLandStatus()) { transform.position = Vector2.MoveTowards(birdPos, target.transform.position, speed * Time.deltaTime); } } }
public void setCropMenu(bool b, FertileLand tempLand) { houseMenuPanel.SetActive(b); // [!] other buttons disable // level2.gameObject.SetActive(!b); // level3.gameObject.SetActive(!b); LVL2_BTN.gameObject.SetActive(!b); LVL3_BTN.gameObject.SetActive(!b); currMonLevel2.gameObject.SetActive(!b); currMonLevel3.gameObject.SetActive(!b); exitButton.gameObject.SetActive(!b); menuCropsText.gameObject.SetActive(!b); sellButton.gameObject.SetActive(!b); exitButton.gameObject.SetActive(b); growButton.gameObject.SetActive(b); landtoPlant = tempLand; }
// Use this for initialization void Start() { delay = 7f; cropDestroyed = false; landed = false; sprFlying = crowSprites.crowArray[0]; sprLanded = crowSprites.crowArray[1]; crowRenderer = this.GetComponent <SpriteRenderer>(); crowRenderer.sprite = sprFlying; potentialTargets = GameObject.FindGameObjectsWithTag("Crop"); selectedIndex = Random.Range(0, potentialTargets.Length); target = potentialTargets[selectedIndex].transform; targetedLand = target.gameObject.GetComponent <FertileLand>(); flyAway = GameObject.FindGameObjectWithTag("DestroyPoint").transform; killBird = false; }
//private UnityAction m_FirstAction; void Start() { screenText.gameObject.SetActive(false); houseMenuPanel.SetActive(false); menuCropsText.gameObject.SetActive(false); exitButton.gameObject.SetActive(false); menuCropsText.gameObject.SetActive(false); growButton.gameObject.SetActive(false); LVL2_BTN.gameObject.SetActive(false); LVL3_BTN.gameObject.SetActive(false); // level2.gameObject.SetActive(false); // level3.gameObject.SetActive(false); currMonLevel2.gameObject.SetActive(false); currMonLevel3.gameObject.SetActive(false); player = GameObject.FindGameObjectWithTag("Player").GetComponent <Player>(); landtoPlant = GameObject.FindGameObjectWithTag("Crop").GetComponent <FertileLand>(); house = GameObject.FindGameObjectWithTag("House").GetComponent <HouseManager>(); menuCropsText.text = "Crops: " + player.getCurrentCrops(); moneyText.color = Color.green; cropsText.color = Color.yellow; }