예제 #1
0
        public IFigur FindetGegenstand(IGegenstand gegenstand)
        {
            if (gegenstand is LebensPunkt)
            {
                return(new Mario(Leben.LebenErhöhen(), Gegenstand));
            }

            if (Gegenstand is IBlume && gegenstand is Pilz)
            {
                return(new Mario(Leben, Gegenstand));
            }

            return(new Mario(Leben, gegenstand));
        }
예제 #2
0
        public Mario(ILeben leben, IGegenstand gegenstand)
        {
            Leben      = leben;
            Gegenstand = gegenstand;

            if (gegenstand is Stern stern)
            {
                Observable
                .Timer(TimeSpan.FromSeconds(2))
                .Subscribe(x =>
                {
                    Gegenstand = stern.Gegenstand;
                });
            }
        }
예제 #3
0
        static void Main(string[] args)
        {
            IGegenstand[] gegenstand = new IGegenstand[3];
            gegenstand[0] = new Trank(100, "Redbull");
            gegenstand[1] = new Schwert(2350, "Goldschwert");
            gegenstand[2] = new Schwert(125, "Plastikschwert");

            foreach (IGegenstand element in gegenstand)
            {
                if (element is Trank)
                {
                    Console.WriteLine("Der Trank ist {0} hat einen Wert von {1} ", element.Name, element.Goldwert);
                }
                else if (element is Schwert)
                {
                    Console.WriteLine("Das Schwert ist ein {0} hat einen Wert von {1} ", element.Name, element.Goldwert);
                }
                Console.ReadKey();
            }
        }
예제 #4
0
 /// <summary>
 /// Mario mit 0 Leben
 /// </summary>
 /// <param name="gegenstand"></param>
 public Mario(IGegenstand gegenstand) : this(0.Leben(), gegenstand)
 {
 }
예제 #5
0
 public Stern(IGegenstand gegenstand)
 {
     Gegenstand = gegenstand;
 }