예제 #1
0
 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);
     }
 }
예제 #2
0
        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();
                        }
                    }
                }
            }
        }
예제 #3
0
 private void Cancel()
 {
     World.CallLuaFunctions(OnCancel.ToArray(), this);
     this.workTile.RemoveWork(this);
 }