static void Main(string[] args) { Dog dog = new Dog(); Poo dogPoo = dog.Excrement; Cat cat = new Cat(); RadioactivePoo catPoo = cat.StronglyTypedExcrement(); }
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); }
public override int Tick() { Step++; if (Step > 2) { Poo.FacingRight = !Poo.FacingRight; Poo.SetSprite(3); Finished = true; } else { Poo.SetSprite(start + Step); } return(200); }
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); }
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(); }
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); }
public void ReturnToPool(Poo poo) { pooListDisabled.Add(poo); pooListEnabled.Remove(poo); poo.gameObject.SetActive(false); }
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); }