protected override void Turn() { if (target == null) { return; } if (targetMovement != null) { targetPath = this.FindPath(targetMovement.projectedLocation); } if (targetPath.MoveNext()) { Move(targetPath.Current); } else { Banana banana = target.GetComponent <Banana>(); if (banana != null) { banana.Eat(); //Eat() will trigger GiveUpOnCurrentTarget() } else { GiveUpOnCurrentTarget(); //becuase it has been reached } } }
protected void EatingBanana() { if (Channeling(ItemList.Banana, PlayerActions.Eat) == PlayerActions.Eat) { Banana bana = (Banana)(this.GetPlayerData().GetInventory()[Global.ItemNames[ItemList.Banana]]); bana.Eat(this.GetPlayerData()); Nourish.Play(); } }
public void EatFruits() { double dblpercent; MakeFruits();//now made properly with scope Console.WriteLine("You have an Apple and a Banana in your fruit garden.\n"); Console.WriteLine("What Percent of the Apple would you like to eat?"); dblpercent = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("\nWhat Percent of the Banana would you like to eat?"); dblpercent = Convert.ToDouble(Console.ReadLine()); Console.Write("You have "); apple.Eat(dblpercent); //Eat was never shown Console.Write("% of your apple, and "); banana.Eat(dblpercent); //Eat was never shown Console.Write("% of your banana left."); Console.ReadLine(); }