Exemplo n.º 1
0
    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
            }
        }
    }
Exemplo n.º 2
0
 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();
    }