Exemplo n.º 1
0
 public Laboratory(ICommandInterface cli)
 {
     _cli        = cli;
     _animals    = new List <Animal>();
     _bigMachine = new BigMachine(cli);
     _purrer     = new Purrer(_cli);
     _squeaker   = new Squeaker(_cli);
 }
    static void Main(string[] args)
    {
        var bigCog     = new BigCog();
        var smallCog   = new SmallCog();
        var bigMachine = new BigMachine();

        bigMachine.Cog = smallCog;    // compile error
        bigMachine.Cog = bigCog;      // ok
        Machine[] anyMachine = { new SmallMachine(), new BigMachine() };
        anyMachine[0].Cog = smallCog; // ok
        anyMachine[1].Cog = smallCog; // runtime exception
        anyMachine[1].Cog = bigCog;   // ok
        Console.ReadKey();
    }
Exemplo n.º 3
0
        private void BigMachineSpawn()
        {
            if (bigMachineList.Count <= 1)
            {
                BigMachine bm = new BigMachine(stand, walk1, walk2, new Vector2(9500, 190), player);
                bm.spriteEffect = SpriteEffects.None;
                bm.isVisible    = true;

                BigMachine bm2 = new BigMachine(stand, walk1, walk2, new Vector2(1900, 190), player);
                bm2.spriteEffect = SpriteEffects.None;
                bm2.isVisible    = true;
                bigMachineList.Add(bm);
                bigMachineList.Add(bm2);
            }
        }