public void SetPlot(Plot plot) { if (!(plot is PlotPrison)) { Debug.LogError("Cannot set plot that not prison to UseFreeCard UI"); return; } else { _plot = plot as PlotPrison; } }
public void OnPlotPassBy(Player player, Plot plot) { Debug.Log("Receive On Plot Pass by"); if (player == Owner) { if (plot.Id == PLOT.PRISON) { Debug.Log("Activate Sunnary Sundial"); PlotPrison prison = plot as PlotPrison; int prisonerCount = prison.AllPlayerImprisonDurations.Count; int totalBonusMana = manaPerPrisoner * prisonerCount; Owner.ChangeMana(totalBonusMana); /* Thanh, why didn't you delete the item when it's used? */ // Thanh: My bad bro Owner.RemoveItem(this); ItemManager.Ins.AddItemToPool(this); //*/ Activate(""); if (this.gameObject != null) { Destroy(this.gameObject, 0.1f); } } else { Debug.Log("Subcribe to wrong plot " + plot.Id); } } }