static void Main(string[] args)
 {
     Dog            dog    = new Dog();
     Poo            dogPoo = dog.Excrement;
     Cat            cat    = new Cat();
     RadioactivePoo catPoo = cat.StronglyTypedExcrement();
 }
Example #2
0
        public override int Tick()
        {
            Step = (Step + 1) % 2;
            Poo.SetSprite(4 + Step);
            if (Poo.IsMouseDown)
            {
                velocity = 0;
                return(100);
            }
            int    newvelocity   = velocity + acceleration;
            Screen currentScreen = Screen.FromControl(Poo);

            if (!currentScreen.WorkingArea.Contains(new Rectangle(Poo.Location.X, Poo.Location.Y + newvelocity, Poo.Width, Poo.Height)))
            {
                Impact(currentScreen.WorkingArea, newvelocity, false);
                return(100);
            }
            var rect = Utility.GetRectangleAtPoint(Poo.Location.X + Poo.Width / 2, Poo.Location.Y + Poo.Height + newvelocity);

            if (rect != Rectangle.Empty &&
                Between(rect.Y, Poo.Location.Y + Poo.Height, Poo.Location.Y + Poo.Height + newvelocity) &&
                rect.Contains(Poo.Location.X, Poo.Location.Y + Poo.Height + newvelocity) &&
                rect.Contains(Poo.Location.X + Poo.Width, Poo.Location.Y + Poo.Height + newvelocity))
            {
                Impact(rect, newvelocity, true);
                return(100);
            }
            velocity = newvelocity;
            Poo.Top += velocity;
            return(100);
        }
Example #3
0
 public override int Tick()
 {
     Step++;
     if (Step > 2)
     {
         Poo.FacingRight = !Poo.FacingRight;
         Poo.SetSprite(3);
         Finished = true;
     }
     else
     {
         Poo.SetSprite(start + Step);
     }
     return(200);
 }
Example #4
0
 public override int Tick()
 {
     if (Step == 1)
     {
         FormMain.PlaySound("sneeze.wav");
     }
     if (Step >= sprites.Length)
     {
         Finished = true;
     }
     else
     {
         Poo.SetSprite(sprites[Step]);
         Step++;
     }
     return(200);
 }
Example #5
0
    static void Main(string[] args)
    {
        var           dog     = new Dog();
        var           cat     = new Cat();
        IAnimal <Poo> animal1 = dog;
        IAnimal <Poo> animal2 = cat;
        Poo           dogPoo  = dog.Excrement;
        //RadioactivePoo dogPoo2 = dog.Excrement; // Error, dog poo is not RadioactivePoo.
        Poo            catPoo     = cat.Excrement;
        RadioactivePoo catPoo2    = cat.Excrement;
        Poo            animal1Poo = animal1.Excrement;
        Poo            animal2Poo = animal2.Excrement;

        //RadioactivePoo animal2RadioactivePoo = animal2.Excrement; // Error, IAnimal<Poo> reference do not know better.
        Console.WriteLine("Dog poo name: {0}", dogPoo.Name);
        Console.WriteLine("Cat poo name: {0}, decay period: {1}", catPoo.Name, catPoo2.DecayPeriod);
        Console.WriteLine("Press any key");
        var key = Console.ReadKey();
    }
Example #6
0
 public override int Tick()
 {
     if (movetype == 0)
     {
         Poo.SetSprite(2 + Step % 2);
     }
     else if (movetype == 1)
     {
         Poo.SetSprite(4 + Step % 2);
     }
     // todo: running into the edge of another poo or a background window causes the poo to bounce away
     // alternatively, step and run up the side of the window
     // if running and reach edge of a window with nothing below, jump off ?
     Poo.Left      += stepdistance * (Poo.FacingRight ? 1 : -1);
     totaldistance -= stepdistance;
     if (totaldistance <= 0)
     {
         Finished = true;
     }
     return(200);
 }
Example #7
0
 public void ReturnToPool(Poo poo)
 {
     pooListDisabled.Add(poo);
     pooListEnabled.Remove(poo);
     poo.gameObject.SetActive(false);
 }
Example #8
0
 public void ScanPoo(IPlayer sender, Poo poo)
 {
     sender.Reply($"You hold the {poo} into the green light. It shimmers green.");
     sender.Room.SendText($"{sender} does something strange with the {this}. Maybe leave him alone for now?", sender);
 }