public bool NextStage() { if (currentStageIndex == 0) { currentStage.GetComponent <FirstPlantStage>().Drop(); } currentStageIndex++; if (currentStageIndex >= stages.Count) { return(false); } if (currentStage != null) { currentStage.gameObject.SetActive(false); } currentStage = stages[currentStageIndex]; currentStage.gameObject.SetActive(true); Debug.Log("Next stage:" + currentStage.name); toNextStageTimer.ResetTimer(); toNextStageTimer.StartTimer(); return(true); }
public override bool Drop(int i, int j) { PlantStage stage = GetStage(i, j); //The current stage of the herb //Only drop items if the herb is grown if (stage == PlantStage.Grown) { Item.NewItem(new Vector2(i, j).ToWorldCoordinates(), ItemType <ExampleHerbSeeds>()); } return(false); }
public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { PlantStage stage = GetStage(i, j); if (stage == PlantStage.Grown) { r = g = b = 0.25f; } else { r = g = b = 0f; } }
private void BecomeTower() { if (beingEaten) { shouldBecomTower = true; return; } spikes.SetActive(true); plantStage = PlantStage.Tower; capsule.isTrigger = false; anim.SetBool("Tower", true); DestroyAdjacentTiles(); ammo = maxAmmo; updateAmmoUI(); }
public void GrowPlant() { ; plantStage = PlantStage.Grown; transform.parent.GetComponent <GridCell>().setHasPlantRipe(true); anim.SetBool("Ready", true); if (consumers.Count > 0) { beingEaten = true; consumers[0].GetComponentInParent <Enemy>().ConsumePlant(this); return; } RuntimeManager.PlayOneShot("event:/SFX/Scenery/flower_ready", Vector3.zero); Invoke("BecomeTower", PlantToTowerTime); }
public override void RandomUpdate(int i, int j) { Tile tile = Framing.GetTileSafely(i, j); PlantStage stage = GetStage(i, j); if (stage != PlantStage.Grown) { tile.frameX += FrameWidth; if (Main.netMode != NetmodeID.SinglePlayer) { NetMessage.SendTileSquare(-1, i, j, 1); } } }
public override bool Drop(int i, int j) { PlantStage stage = GetStage(i, j); if (stage == PlantStage.Grown) { Item.NewItem(new Vector2(i, j).ToWorldCoordinates(), ItemType <PrismaticSeeds>()); Item.NewItem(new Vector2(i, j).ToWorldCoordinates(), ItemType <PrismaticAsterItem>()); } else if (stage != PlantStage.Grown) { Item.NewItem(new Vector2(i, j).ToWorldCoordinates(), ItemType <PrismaticSeeds>()); } return(true); }
public override bool Drop(int i, int j) { PlantStage stage = GetStage(i, j); if (stage == PlantStage.Grown) { Item.NewItem(new Vector2(i, j).ToWorldCoordinates(), ModContent.ItemType <SkyBudItem>()); Item.NewItem(new Vector2(i, j).ToWorldCoordinates(), ModContent.ItemType <SkyBudSeeds>(), Main.rand.Next(2, 4)); } else if (stage == PlantStage.Growing) { Item.NewItem(new Vector2(i, j).ToWorldCoordinates(), ModContent.ItemType <SkyBudItem>()); } return(false); }
public override void KillMultiTile(int i, int j, int frameX, int frameY) { float nearestB = MultiCompat(i, j); float nearestT = MultiCompat(i, j - 1); PlantStage stage = (PlantStage)(frameX / FrameWidth); if (nearestB <= 106 * 106 && nearestT <= 106 * 106 && stage == PlantStage.Grown) { Item.NewItem(i * 16, j * 16, 16, 32, ItemID.CobaltOre, 3); Item.NewItem(i * 16, j * 16, 16, 32, ItemType <Items.Seeds.Stalseeds.CobaltSeed>(), 2); } else if (Main.rand.NextBool()) { Item.NewItem(i * 16, j * 16, 16, 32, ItemType <Items.Seeds.Stalseeds.CobaltSeed>(), 1); } }
public override void KillMultiTile(int i, int j, int frameX, int frameY) { float nearestB = MultiCompat(i, j); float nearestT = MultiCompat(i, j - 1); // doesn't use GetStage due to coordinate complications PlantStage stage = (PlantStage)(frameX / FrameWidth); if (nearestB <= 84 * 84 && nearestT <= 84 * 84 && stage == PlantStage.Grown) { Item.NewItem(i * 16, j * 16, 16, 32, ItemID.FallenStar, 3); Item.NewItem(i * 16, j * 16, 16, 32, ItemType <Items.Seeds.Misc.Stardust>(), 2); } else if (Main.rand.NextBool()) { Item.NewItem(i * 16, j * 16, 16, 32, ItemType <Items.Seeds.Misc.Stardust>(), 1); } }
public override void RandomUpdate(int i, int j) { Tile tile = Framing.GetTileSafely(i, j); //Safe way of getting a tile instance PlantStage stage = GetStage(i, j); //The current stage of the herb //Only grow to the next stage if there is a next stage. We dont want our tile turning pink! if (stage != PlantStage.Grown) { //Increase the x frame to change the stage tile.frameX += FrameWidth; //If in multiplayer, sync the frame change if (Main.netMode != NetmodeID.SinglePlayer) { NetMessage.SendTileSquare(-1, i, j, 1); } } }
public override void RandomUpdate(int i, int j) { Tile Btile = Framing.GetTileSafely(i, j); Tile Ttile = Framing.GetTileSafely(i, (j - 1)); PlantStage stage = GetStage(i, j); if (stage != PlantStage.Grown) { if (Btile.frameY != 0) { Btile.frameX += FrameWidth; Ttile.frameX += FrameWidth; } } if (Main.netMode != NetmodeID.SinglePlayer) { NetMessage.SendTileSquare(-1, i - 1, j - 1, 3); } }
public override void RandomUpdate(int i, int j) { Tile btile = Framing.GetTileSafely(i, j); Tile ttile = Framing.GetTileSafely(i, (j - 1)); PlantStage stage = GetStage(i, j); if (stage != PlantStage.Grown) { if (btile.frameY != 0) { btile.frameX += FrameWidth; ttile.frameX += FrameWidth; } } //If in multiplayer, sync the frame change if (Main.netMode != NetmodeID.SinglePlayer) { NetMessage.SendTileSquare(-1, i - 1, j - 1, 3); } }
public override bool Drop(int i, int j) { PlantStage stage = GetStage(i, j); //The current stage of the herb //Only drop items if the herb is grown if (stage == PlantStage.Grown) { if (Main.rand.Next(0, 10) == 0) { Item.NewItem(new Vector2(i, j).ToWorldCoordinates(), mod.ItemType("GeodeObsidian")); } else { Item.NewItem(new Vector2(i, j).ToWorldCoordinates(), mod.ItemType("Obstidian")); } } Item.NewItem(new Vector2(i, j).ToWorldCoordinates(), mod.ItemType("ObsidianHerbSeeds")); //this is buggy for some reason return(false); }
private void Awake() { parentPlant = GetComponent <Plant>(); foreach (Transform child in transform) { if (!child.gameObject.CompareTag("Stage")) { continue; } PlantStage stage = child.GetComponent <PlantStage>(); stage.stageController = this; stages.Add(stage); stage.gameObject.SetActive(false); } toNextStageTimer = gameObject.AddComponent <Timer>(); toNextStageTimer.SetTimer(timeToNextStage); toNextStageTimer.StartTimer(); NextStage(); }
public void SetPlantStage(PlantStage newPlantStage) { plantStage = newPlantStage; }