Exemplo n.º 1
0
        public Buzzard()
        {
            // Initialize instance variables
            type          = "Buzzard";
            Value         = 500;
            speed         = SPEED;
            angle         = 0;
            updateGraphic = 0;
            prevAngle     = angle;
            droppedEgg    = false;
            // Starting state is standing
            state = new EnemyStandingState();
            // Determine the color of the Mik
            Random rand = new Random();

            switch (rand.Next(3))
            {
            case 0:
                color = "red";
                break;

            case 1:
                color = "blue";
                break;

            case 2:
                color = "silver";
                break;

            default:
                color = "red";
                break;
            }
            imagePath = "Images/Enemy/mik_" + color + "_stand.png";
            coords    = new Point(0, 0);
            World.Instance.objects.Add(this);
        }
Exemplo n.º 2
0
        // Class Constructor
        public Egg()
        {
            // Initialize variables
            height         = 30;
            width          = 30;
            type           = "Egg";
            Value          = 250;
            updateGraphic  = 0;
            seconds        = 0;
            milliseconds   = 3;
            alreadyHatched = false;
            mounted        = false;
            // Initialize the State Machine dictionary
            stateMachine = new StateMachine();
            EnemyStandingState stand = new EnemyStandingState(this);

            stateMachine.stateDict.Add("stand", stand);
            stateMachine.stateDict.Add("fall", new EnemyFallingState(this)
            {
                Angle = 270
            });
            stateMachine.stateDict.Add("fall_right", new EnemyFallingState(this)
            {
                Angle = 315
            });
            stateMachine.stateDict.Add("fall_left", new EnemyFallingState(this)
            {
                Angle = 225
            });
            stateMachine.stateDict.Add("hatching", new EggHatchingState(this));
            stateMachine.stateDict.Add("hatched", new EggHatchedState(this));

            imagePath = "Images/Enemy/egg1.png";
            coords    = new Point(0, 0);
            World.Instance.objects.Add(this);
            World.Instance.enemies.Add(this);
        }