protected void waitForAnimation() { if (wait == true) { wait = false; } else if (!wait && spreadTime > 0 && !planted) { //StageManager.OnSpread += giveSpreadToPlant; StageManager.AddSpreadingPlant(GetComponent <Flower>(), uniqueID); planted = true; } }
public bool Place(Structs.id seed, bool OG, int plantID = -1, bool buffer = false) { if (occupied) { return(false); } occupied = true; occupiedPlant = seed; PlantPooler[] pools = FindObjectsOfType <PlantPooler>(); foreach (PlantPooler pool in pools) { if (seed == pool.ID) { GameObject plant = pool.GetObject(); if (plant.gameObject.GetComponent <GrowingPlant>().occupiedBlock == null) { plant.gameObject.GetComponent <GrowingPlant>().occupiedBlock = this.gameObject.GetComponent <Block>(); } plant.gameObject.GetComponent <GrowingPlant>().isOriginal = OG; //Gets a new plantID if none is given uniqueID = (plantID == -1) ? getNextPlantID : plantID; plant.GetComponent <GrowingPlant>().uniqueID = uniqueID; //plant.GetComponent<GrowingPlant>().giveLifeToPlant(); plant.transform.parent = transform; plant.gameObject.transform.localPosition = new Vector3(0f, 0f, -1f); //Adds flower to list if (plant.GetComponent <GrowingPlant>().plantID == Structs.id.flower) { StageManager.AddSpreadingPlant(plant.GetComponent <GrowingPlant>(), plant.GetComponent <GrowingPlant>().uniqueID); //Has the flower not spread first turn if buffer is true if (buffer) { plant.gameObject.GetComponent <GrowingPlant>().setSpreadTime = 0; } } DisableFlowers(); plant.SetActive(true); return(true); } } return(false); }