コード例 #1
0
ファイル: Enemy.cs プロジェクト: huynhrichy/PandaPanic
        public Enemy(int type, Random random)
            : this(type,
    
           new Vector2(random.Next(0, (int)Game1.SCREEN_WIDTH), random.Next(0, (int)Game1.SCREEN_HEIGHT)),
           new Vector2(0, 0),
           random)
        {
            speed.X = random.Next(-MAX_SPEED, MAX_SPEED);
            speed.Y = random.Next(-MAX_SPEED, MAX_SPEED);

            Alive = true;
            moveType = 0;

            moveSwitch = new Counter(random.Next(1000, 3000));
            counter = new Counter(random.Next(10, 20));
            pause = new Counter(random.Next(100, 200));

            rectangle = new Rectangle((int)Position.X, (int)Position.Y, SIZE, SIZE);

            textureDecision = new List<Tuple<Speed, Rectangle>>();

            textureDecision.Add(new Tuple<Speed, Rectangle>(() => speed.Y < 0, sources["up"]));
            textureDecision.Add(new Tuple<Speed, Rectangle>(() => speed.X < 0, sources["left"]));
            textureDecision.Add(new Tuple<Speed, Rectangle>(() => speed.Y > 0, sources["down"]));
            textureDecision.Add(new Tuple<Speed, Rectangle>(() => speed.X > 0, sources["right"]));
        }
コード例 #2
0
ファイル: Trail.cs プロジェクト: huynhrichy/PandaPanic
        public Trail(Rectangle source)
        {
            rectangle = new Rectangle(0, 0, Moveable.SIZE, Moveable.SIZE);

            positions = new List<Vector2>();
            sources = new List<Rectangle>();

            for (int i = 0; i < SIZE; i++)
            {
                positions.Add(new Vector2(0, 0));
                sources.Add(source);
            }

            timer = new Counter(DELAY);
        }
コード例 #3
0
ファイル: Controller.cs プロジェクト: huynhrichy/PandaPanic
        public Controller()
        {
            gameMenu = new Menu[]{
                startGame, settings, instructions, credits, exit, back
            };

            gameSettings = new Dictionary<String, int>();
            gameSettings.Add("round time", DEFAULT_ROUND_TIME);
            gameSettings.Add("#rounds", DEFAULT_NUM_OF_ROUNDS);
            gameSettings.Add("#players", NUM_OF_PLAYERS);

            state = STATE.MAINMENU;
            pauseTimer = new Counter(PAUSE_TIME * FPS);
            roundTimer = new Counter(DEFAULT_ROUND_TIME * FPS);
            artist = new Game.Game_Objects.Artist();
            widget = new WidgetDemonstration();
            initGame = true;
        }