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周分の制限時間で }
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 モーションの生成・登録→ディクショナリでの管理に変更 }
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 モーションの生成・登録→ディクショナリで管理に変更 }
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(); }
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; }
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) }; }