コード例 #1
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="position"></param>
        /// <param name="gameDevice"></param>
        /// <param name="mediator"></param>
        public Item(Vector2 position, GameDevice gameDevice, IGameObjectMediator mediator)
            : base("dango", position, 64, 64, gameDevice)
        {
            this.mediator = mediator;
            score         = 100;
            isDeadFlag    = false;

            sound = GameDevice.Instance().GetSound();
        }
コード例 #2
0
ファイル: Enemy.cs プロジェクト: erikusia/OneButtonGame
        public Enemy(Vector2 position, GameDevice gameDevice, IGameObjectMediator mediator)
            : base("Enemy", position, 64, 64, gameDevice)
        {
            this.position = position;
            this.mediator = mediator;
            var game = GameDevice.Instance();

            sound = game.GetSound();
        }
コード例 #3
0
 public PlayerBullet2(Vector2 position, GameDevice gameDevice, IGameObjectMediator mediator, GameObjectManager gameObjectManager)
     : base("Bullet1", position, 16, 16, gameDevice)
 {
     this.position          = position;
     this.mediator          = mediator;
     this.gameObjectManager = gameObjectManager;
     speed    = new Vector2(5, -30);
     shotTime = 60;
 }
コード例 #4
0
 public EnemyBullet2(Vector2 position, GameDevice gameDevice, IGameObjectMediator mediator)
     : base("Bullet2", position, 16, 16, gameDevice)
 {
     this.position = position;
     this.mediator = mediator;
     speed         = new Vector2(0, -30);
     shotTime      = 60;
     a             = position;
 }
コード例 #5
0
        private Timer actionTimer; //【追加】アクションモーションを魅せるためのタイマー

        public Human(Vector2 position, GameDevice gameDevice, IGameObjectMediator mediator)
            : base("momotaro_R", position, 64, 64, 40, 60, gameDevice)
        {
            velocity      = Vector2.Zero;
            dir           = Direction.Right;
            isJump        = true;
            isClearFlag   = false;
            this.mediator = mediator;
            map           = mediator.GetMap();
            damageShow    = new CountDownTimer(0.2f);

            godMod = false;

            sound      = GameDevice.Instance().GetSound();
            soundTimer = new CountDownTimer(0.5f);

            #region モーションの生成→ディクショナリによる管理に変更
            //movemotion = new Motion();
            //for (int i = 0; i < 7; i++)
            //{
            //    movemotion.Add(i, new Rectangle(i * 64, 0, 64, 64));
            //}
            //movemotion.Initialize(new Range(0, 6), new CountDownTimer(0.15f));

            //jumpmotion = new Motion();
            //for (int i = 0; i < 5; i++)
            //{
            //    jumpmotion.Add(i, new Rectangle(i * 64, 0, 64, 64));
            //}
            //jumpmotion.Initialize(new Range(0, 4), new CountDownTimer(0.15f));
            #endregion モーションの生成→ディクショナリによる管理に変更

            //【追加】モーションの生成・登録
            motionDict = new Dictionary <MotionName, Motion>()
            {
                { MotionName.idling, new Motion(new Range(0, 4), new CountDownTimer(0.10f)) }, //普通のアニメーション
                { MotionName.attack, new Motion(new Range(0, 5), new CountDownTimer(0.07f)) }, //攻撃モーション
            };

            //モーション切り取り位置の追加
            for (int i = 0; i <= 4; i++) //アクション以外
            {
                motionDict[MotionName.idling].Add(i, new Rectangle(new Point(64 * i, 0), new Point(64)));
            }
            for (int i = 0; i <= 5; i++) //アクション
            {
                //切り取り範囲が異なるので描画時に注意!!
                motionDict[MotionName.attack].Add(i, new Rectangle(new Point(96 * i, 0), new Point(96, 64)));
            }

            //現在モーションはジャンプモーションに設定
            currentMotion = motionDict[MotionName.idling];

            //【追加】アクションを魅せるためのタイマーを初期化
            actionTimer = new CountDownTimer(0.35f); //アクションモーション1周分の制限時間で
        }
コード例 #6
0
 public Player(Vector2 position, float rotation, Vector2 origin, GameDevice gameDevice,
               IGameObjectMediator mediator)
     : base("red", position, rotation, origin, 32, 32, gameDevice)
 {
     velocity      = Vector2.Zero;
     isDeadFlag    = false;
     this.mediator = mediator;
     this.origin   = new Vector2(16, 16);
     this.rotation = 0.0f;
 }
コード例 #7
0
ファイル: EnemyBullet.cs プロジェクト: erikusia/OneButtonGame
 public EnemyBullet(Vector2 position, GameDevice gameDevice, IGameObjectMediator mediator)
     : base("Bullet2", position, 16, 16, gameDevice)
 {
     this.position  = position;
     this.mediator  = mediator;
     playerPosition = new Vector2(Player.playerPosition.X, Player.playerPosition.Y);
     Console.WriteLine(playerPosition);
     a = playerPosition - position;
     a.Normalize();
 }
コード例 #8
0
 private IGameObjectMediator mediator;//ゲームオブジェクト仲介者
 public Ship(Vector2 position, float rotation, Vector2 origin, GameDevice gameDevice,
             IGameObjectMediator mediator, int score)
     : base("green", position, rotation, origin, 32, 32, gameDevice)
 {
     isDeadFlag    = false;
     this.mediator = mediator;
     this.origin   = new Vector2(16, 16);
     this.score    = score;
     isRide        = true;
 }
コード例 #9
0
        private Timer timer; //間隔用タイマー
        //private float burnTime; //表示時間
        //private int burns; //高さ
        //private float burnInterval; //間隔

        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="position"></param>
        /// <param name="gameDevice"></param>
        public Trap(Vector2 position, GameDevice gameDevice, IGameObjectMediator mediator)
            : base("tubo", position, 64, 64, gameDevice)
        {
            this.mediator = mediator;

            //this.burnInterval = burnInterval;
            timer = new CountDownTimer(4.0f);

            //this.burns = burns;
            //this.burnTime = burnTime;
        }
コード例 #10
0
        public Bird(Vector2 position, GameDevice gameDevice, IGameObjectMediator mediator)
            : base("kiji_movemotion", position, 64, 64, 40, 60, gameDevice)
        {
            velocity = Vector2.Zero;
            //isFall = true;
            fallSpeed     = 0.4f;
            isJump        = true;
            jumpCnt       = 2;
            isClearFlag   = false;
            this.mediator = mediator;
            map           = mediator.GetMap();
            damageShow    = new CountDownTimer(0.2f);

            sound      = GameDevice.Instance().GetSound();
            soundTimer = new CountDownTimer(0.5f);

            //【追加】モーションの登録・生成
            motionDict = new Dictionary <MotionName, Motion>()
            {
                { MotionName.jump, new Motion(new Range(0, 4), new CountDownTimer(0.10f)) },
                { MotionName.move, new Motion(new Range(0, 5), new CountDownTimer(0.15f)) },
                { MotionName.idling, new Motion(new Range(0, 5), new CountDownTimer(0.15f)) },
            };

            for (int i = 0; i <= 4; i++)
            {
                motionDict[MotionName.jump].Add(i, new Rectangle(new Point(64 * i, 0), new Point(64)));
            }
            for (int i = 0; i <= 5; i++)
            {
                motionDict[MotionName.move].Add(i, new Rectangle(new Point(64 * i, 0), new Point(64)));
            }
            for (int i = 0; i <= 5; i++)
            {
                motionDict[MotionName.idling].Add(i, new Rectangle(new Point(64 * i, 0), new Point(64)));
            }


            #region モーションの生成・登録→ディクショナリでの管理に変更
            //movemotion = new Motion();
            //for(int i=0; i<7; i++)
            //{
            //    movemotion.Add(i, new Rectangle(i * 64, 0, 64, 64));
            //}
            //movemotion.Initialize(new Range(0, 6), new CountDownTimer(0.15f));

            //jumpmotion = new Motion();
            //for (int i = 0; i < 5; i++)
            //{
            //    jumpmotion.Add(i, new Rectangle(i * 64, 0, 64, 64));
            //}
            //jumpmotion.Initialize(new Range(0, 4), new CountDownTimer(0.15f));
            #endregion モーションの生成・登録→ディクショナリでの管理に変更
        }
コード例 #11
0
 public Player3(Vector2 position, GameDevice gameDevice, IGameObjectMediator mediator)
     : base("player1", position, 48, 48, gameDevice)
 {
     this.mediator = mediator;
     reset         = false;
     moving        = false;
     stop          = false;
     addRadian     = 0.1f;
     _hit          = false;
     nextscene     = 0;
 }
コード例 #12
0
        public ShotEnemyAI(Character character, IGameObjectMediator mediator)
            : base(character, mediator)
        {
            velocity.X = 0;
            gravity    = 0.4f;

            bulletCnt      = 0;
            bulletInterval = 100;

            sound = GameDevice.Instance().GetSound();
        }
コード例 #13
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="gameDevice"></param>
        public Map(GameDevice gameDevice, IGameObjectMediator mediator)
        {
            mapList         = new List <List <GameObject> >(); //マップの実体生成
            this.gameDevice = gameDevice;
            this.mediator   = mediator;

            //【追加】ブロック番号のリストを初期化(要素番号と要素の値がずれているのに注意)
            blkNum = new List <int>
            {
                1, 2, 3, 4, 5, 6, 7, 8, 9
            };
        }
コード例 #14
0
        private IGameObjectMediator mediator; //仲介者

        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="mediator"></param>
        public GameObjectCSVParser(IGameObjectMediator mediator)
        {
            this.mediator = mediator;

            csvReader     = new CSVReader();
            gameObjects   = new List <GameObject>();
            functionTable = new Dictionary <string, iFunction>();

            //ディクショナリにデータを追加
            //文字列はクラス名、それと実行用メソッド
            //functionTable.Add("Block", newBlock);
            //functionTable.Add("Trap", newTrap);
        }
コード例 #15
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="mediator"></param>
        public PlayerManager(IGameObjectMediator mediator)
        {
            this.mediator = mediator;
            sound         = GameDevice.Instance().GetSound();

            //リストの生成
            if (playerDict != null)
            {
                playerDict.Clear();
                return;
            }
            playerDict = new Dictionary <PlayerName, IPlayable>();
        }
コード例 #16
0
        public Monkey(Vector2 position, GameDevice gameDevice, IGameObjectMediator mediator)
            : base("saru", position, 64, 64, 40, 60, gameDevice)
        {
            velocity      = Vector2.Zero;
            isJump        = true;
            isClearFlag   = false;
            this.mediator = mediator;
            map           = mediator.GetMap();
            damageShow    = new CountDownTimer(0.2f);

            isRightWallGrip = false;
            isLeftWallGrip  = false;

            currentPositionX = Position.X;

            sound      = GameDevice.Instance().GetSound();
            soundTimer = new CountDownTimer(0.5f);

            //【追加】モーションの登録・生成
            motionDict = new Dictionary <MotionName, Motion>()
            {
                { MotionName.move, new Motion(new Range(0, 4), new CountDownTimer(0.20f)) },
                { MotionName.jump, new Motion(new Range(0, 4), new CountDownTimer(0.20f)) },
                { MotionName.idling, new Motion(new Range(0, 4), new CountDownTimer(0.20f)) },
            };
            for (int i = 0; i <= 4; i++)
            {
                motionDict[MotionName.move].Add(i, new Rectangle(new Point(64 * i, 0), new Point(64)));
                motionDict[MotionName.jump].Add(i, new Rectangle(new Point(64 * i, 0), new Point(64)));
                motionDict[MotionName.idling].Add(i, new Rectangle(new Point(64 * i, 0), new Point(64)));
            }
            currentMotion = motionDict[MotionName.idling];

            #region モーションの生成・登録→ディクショナリで管理に変更
            //movemotion = new Motion();
            //for (int i = 0; i < 7; i++)
            //{
            //    movemotion.Add(i, new Rectangle(i * 64, 0, 64, 64));
            //}
            //movemotion.Initialize(new Range(0, 6), new CountDownTimer(0.15f));

            //jumpmotion = new Motion();
            //for (int i = 0; i < 5; i++)
            //{
            //    jumpmotion.Add(i, new Rectangle(i * 64, 0, 64, 64));
            //}
            //jumpmotion.Initialize(new Range(0, 4), new CountDownTimer(0.15f));
            #endregion モーションの生成・登録→ディクショナリで管理に変更
        }
コード例 #17
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 public GameObjectCSVParser(IGameObjectMediator mediator)
 {
     //仲介者の設定
     this.mediator = mediator;
     //CSV読み込みの実体生成
     csvReader = new CSVReader();
     //ゲームオブジェクトリストの実体生成
     gameObjects = new List <GameObject>();
     //文字列とメソッドを保存するディクショナリの実体生成
     functionTable = new Dictionary <string, iFunction>();
     //ディクショナリにデータを追加
     //文字列はクラス名の文字列と実行用メソッド名
     //functionTable.Add("SlidingBlock", NewSlidingBlock);
     functionTable.Add("Block", NewBlock);
     //functionTable.Add("ChaseEnemy", NewChaseEnemy);//追いかけてくる敵
     //functionTable.Add("JumpingEnemy", NewJumpingEnemy);
 }
コード例 #18
0
        public Player(Vector2 position, float rotation, Vector2 origin, GameDevice gameDevice,
                      IGameObjectMediator mediator)
            : base("ship2", position, rotation, origin, 200, 200, gameDevice)
        {
            velocity      = Vector2.Zero;
            isDeadFlag    = false;
            this.mediator = mediator;
            this.origin   = new Vector2(16, 16);
            this.rotation = 0.0f;

            angle       = Math.PI / 2;
            flyingSpeed = 0;

            weight     = 0.0f;
            score      = 0;
            hitcounter = 0;
        }
コード例 #19
0
ファイル: Player.cs プロジェクト: erikusia/OneButtonGame
        public Player(Vector2 position, GameDevice gameDevice, IGameObjectMediator mediator, GameObjectManager gameObjectManager)
            : base("player", position, 64, 64, gameDevice)
        {
            this.position          = position;
            this.mediator          = mediator;
            this.gameObjectManager = gameObjectManager;
            hp       = 1;
            rotate   = 2.0f;
            rad      = 180.0f;
            angle    = 0;
            center   = new Vector2(385, 600);
            shotTime = 10;
            DeadFlag = false;
            var game = GameDevice.Instance();

            sound        = game.GetSound();
            optionNumber = 0;
        }
コード例 #20
0
        private Motion effectMotion;               //追加

        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="position">初期座標</param>
        /// <param name="gameDevice">ゲームデバイス</param>
        /// <param name="mediator">仲介者</param>
        public Boss(Vector2 position, GameDevice gameDevice, IGameObjectMediator mediator) :
            base("teki", position, 100, 100, 100, 100, gameDevice)
        {
            //各種パラメータの初期化

            color         = Color.White;
            this.mediator = mediator;  //仲介者を引数受け取り
                map = mediator.GetMap();

            time         = new CountUpTimer(10000); //カウントアップタイマーを1万フレーム(200秒弱)で初期化
            currentState = BossState.JumpAttack;    //戦闘態勢は「高速突進」で初期化
                stateNum = 0;
            playerPos  = Vector2.Zero;
            isVertigo  = false;
            isDeadFlag = false; //死亡フラグは偽で初期化

            EntryMotions();
        }
コード例 #21
0
        // private string name;

        public Button(Vector2 position, GameDevice gameDevice,
                      IGameObjectMediator mediator)
            : base("switch_TimeDown", position, 64, 64, gameDevice)
        {
            this.mediator = mediator;
            isTouch       = false;
            isHit         = false;
            id            = GameObjectID.Button;

            buttonState = new Dictionary <Direction, string>()
            {
                { Direction.CanPut, "switch_CanPut" },
                { Direction.TimeDown, "switch_TimeDown" }
            };

            timer        = new CountDownTimer(5f);
            correntState = Direction.CanPut;
        }
コード例 #22
0
ファイル: Player.cs プロジェクト: 3WeekDiverDown/Diver_Down
 public Player(Vector2 position, GameDevice gameDevice, IGameObjectMediator mediator)
     : base("P2", position, 64, 64, gameDevice)
 {
     velocity      = Vector2.Zero;
     this.mediator = mediator;
     slideModify   = Vector2.Zero;
     yVectol       = 0.1f;
     xVectol       = 2f;
     ySpeedMax     = 4;
     xSpeedMax     = 8;
     hp            = 1000;
     goal          = false;
     motion        = new Motion();
     for (int i = 0; i < 2; i++)
     {
         motion.Add(i, new Rectangle(64, 66 * (i / 2), 64, 62));
     }
     motion.Initialize(new Range(0, 1), new CountDownTimer(0.2f));
 }
コード例 #23
0
        public Enemy(string name, Vector2 position, AIName aiName, GameDevice gameDevice, IGameObjectMediator mediator)
            : base(name, position, 64, 64, 55, 60, gameDevice)
        {
            this.Position = position;
            this.aiName   = aiName;
            this.mediator = mediator;
            map           = mediator.GetMap();

            damageTimer     = new CountDownTimer(0.5f);
            gravity         = 0.5f;
            damageVelocityY = -5;

            state = CharaState.Normal;

            SetAI();

            //【追加】モーションの生成・追加
            motionDict = new Dictionary <MotionName, Util.Motion>()
            {
                { MotionName.attack, new Motion(new Range(0, 4), new CountDownTimer(0.25f)) },
                { MotionName.move, new Motion(new Range(0, 4), new CountDownTimer(0.15f)) },
                { MotionName.idling, new Motion(new Range(0, 4), new CountDownTimer(0.25f)) },
            };

            for (int i = 0; i <= 4; i++)
            {
                motionDict[MotionName.attack].Add(i, new Rectangle(new Point(64 * i, 0), new Point(64)));
            }
            for (int i = 0; i <= 4; i++)
            {
                motionDict[MotionName.move].Add(i, new Rectangle(new Point(64 * i, 0), new Point(64)));
            }
            for (int i = 0; i <= 4; i++)
            {
                motionDict[MotionName.idling].Add(i, new Rectangle(new Point(64 * i, 0), new Point(64)));
            }
            //最初のモーションはムーブに設定
            currentMotion = motionDict[MotionName.move];

            //【追加】移動方向の設定
            myDirectionX = Direction.Right;
            myDirectionY = Direction.Top;
        }
コード例 #24
0
 public Option(Vector2 position, GameDevice gameDevice, IGameObjectMediator mediator, GameObjectManager gameObjectManager, float angle, int hp)
     : base("option", position, 32, 32, gameDevice)
 {
     this.position          = position;
     this.mediator          = mediator;
     this.gameObjectManager = gameObjectManager;
     this.hp    = hp;
     this.angle = angle;
     rotate     = 2.0f;
     rad        = 64;
     shotTime   = 10;
     //angle = 0;
     //angle2 = angle + 60;
     //angle3 = angle2 + 120;
     //angle4 = angle3 + 180;
     //angle5 = angle4 + rotate;
     //angle6 = angle5 + rotate;
     // position = CalcPosition(Player.playerPosition, angle, rad);
 }
コード例 #25
0
ファイル: Player2.cs プロジェクト: makimaki501/Twins2
        public Player2(Vector2 position, GameDevice gameDevice, IGameObjectMediator mediator, float addRadian)
            : base("player4", position, 48, 48, gameDevice)
        {
            size            = 64;
            this.mediator   = mediator;
            reset           = false;
            stop            = true;
            this.addRadian  = addRadian;
            _hit            = false;
            nextscene       = 0;
            prevRadian      = 0;
            particleManager = new ParticleManager();

            motion = new Motion();

            motion.Add(0, new Rectangle(size * 0, size * 0, size, size));
            motion.Add(1, new Rectangle(size * 1, size * 0, size, size));
            motion.Add(2, new Rectangle(size * 0, size * 1, size, size));
            motion.Add(3, new Rectangle(size * 1, size * 1, size, size));
            motion.Initialize(new Range(0, 3), new CountDownTimer(0.1f));
        }
コード例 #26
0
        public EnemyAI(Character character, IGameObjectMediator mediator)
        {
            position = character.Position;
            isJump   = true;

            this.mediator = mediator;
            map           = mediator.GetMap();
            rnd           = GameDevice.Instance().GetRandom();

            //マップ当たり判定用リストの作成
            int width        = character.Width;
            int height       = character.Height;
            int widthMargin  = character.WidthMargin;
            int heightMargin = character.HeightMargin;

            checkRList = new List <Vector2>()
            {
                new Vector2(width - widthMargin, heightMargin),
                new Vector2(width - widthMargin, height - heightMargin - 1)
            };
            checkLList = new List <Vector2>()
            {
                new Vector2(widthMargin - 1, heightMargin),
                new Vector2(widthMargin - 1, height - heightMargin - 1)
            };
            checkUList = new List <Vector2>()
            {
                new Vector2(widthMargin, heightMargin - 1),
                new Vector2(width - widthMargin - 1, heightMargin - 1)
            };
            checkDList = new List <Vector2>()
            {
                new Vector2(widthMargin, height - heightMargin),
                new Vector2(width - widthMargin - 1, height - heightMargin)
            };
        }
コード例 #27
0
 public ScoreItem(Vector2 position, GameDevice gameDevice, IGameObjectMediator mediator)
     : base("Scoreup", position, 64, 64, gameDevice)
 {
     this.position = position;
     this.mediator = mediator;
 }
コード例 #28
0
 public TurnEnemyAI(Character character, IGameObjectMediator mediator)
     : base(character, mediator)
 {
     velocity.X = 3;
     gravity    = 0.4f;
 }
コード例 #29
0
 public Enemy2(Vector2 position, GameDevice gameDevice, IGameObjectMediator mediator)
     : base("Enemy2", position, 128, 128, gameDevice)
 {
     this.position = position;
     this.mediator = mediator;
 }
コード例 #30
0
ファイル: PowerUpItem.cs プロジェクト: erikusia/OneButtonGame
 public PowerUpItem(Vector2 position, GameDevice gameDevice, IGameObjectMediator mediator)
     : base("Bulletup", position, 64, 64, gameDevice)
 {
     this.position = position;
     this.mediator = mediator;
 }