void Update() { time += Time.deltaTime; if (time > cooldown && !blossomed) { Blossom(); } if (blossomed && transform.localScale.x < 1.0f) { transform.localScale = Vector3.Lerp(transform.localScale, Vector3.one, Time.deltaTime * blossomSpeed); //Grow } else if (!blossomed) { transform.localScale = Vector3.Lerp(transform.localScale, minScale, Time.deltaTime * blossomSpeed); //Shrink } GetComponentInChildren <Renderer>().material.SetColor("_UserColor", Game.game.GetUserColor(idPlayer)); if (playerOver != null) { BeeMovement bee = playerOver.GetComponent <BeeMovement>(); if (!bee.falling && !bee.recovering && Input.GetButtonDown("Recolect" + bee.GetIdPlayer())) { Recollect(bee); if (polen <= 0) { UnBlossom(); } } } }
void CheckTrigger() { foreach (GameObject player in GameObject.FindGameObjectsWithTag("Player")) { if (Vector3.Distance(transform.position, player.transform.position) < triggerRadius) { BeeMovement bee = player.GetComponent <BeeMovement>(); if (Input.GetButtonDown("Drop" + bee.GetIdPlayer())) { DepositPolen(bee.GetPolen()); } else if (Input.GetButtonDown("Swap" + bee.GetIdPlayer())) { if (idPlayer == bee.GetIdPlayer()) { SwapBees(player); } } } } }