public void DoOnComplete() { if (complete) { return; } foreach (Tile t in relatedTiles) { t.RemoveWork(this); } World.CallLuaFunctions(OnComplete.ToArray(), this); complete = true; if (recipe != null) { WorldController.Instance.DeductMoney(recipe.cost); } }
public void Work(float deltaTime) { if (complete) { return; } if (OnWork != null) { World.CallLuaFunctions(OnWork.ToArray(), this, deltaTime); System.Object[] results = World.GetLuaResult(IsComplete, this); if (results != null && results.Length > 0) { bool isComplete = false; if (bool.TryParse(results[0].ToString(), out isComplete)) { if (isComplete) { DoOnComplete(); } } } } }
private void Cancel() { World.CallLuaFunctions(OnCancel.ToArray(), this); this.workTile.RemoveWork(this); }