static void Main() { // ウィンドウモードに切り替え DX.ChangeWindowMode(DX.TRUE); // フルスクリーン時の画面拡大モードを設定 DX.SetFullScreenScalingMode(DX.DX_FSSCALINGMODE_NEAREST); // ウィンドウに表示する名前を設定 DX.SetMainWindowText("LifeGame"); // ウィンドウのアイコンを設定 //DX.SetWindowIconID(101); DX.SetDoubleStartValidFlag(DX.TRUE); DX.SetGraphMode(Window_X, Window_Y, 32); // DXライブラリの初期化 if (DX.DxLib_Init() == -1) { // エラーが発生したら終了 return; } // ウィンドウが非アクティブでも処理を続ける設定 DX.SetAlwaysRunFlag(DX.TRUE); DX.SetWindowSizeChangeEnableFlag(DX.TRUE); // 裏画面を描画画面に設定 DX.SetDrawScreen(DX.DX_SCREEN_BACK); DX.SetDrawMode(DX.DX_DRAWMODE_BILINEAR); // 各クラスの初期化処理 Drawer Drawer = new Drawer(); Land Land = new Land(); CreatureMgr CreatureMgr = new CreatureMgr(); God God = new God(); ActRegister.Register(); LandformRegister.Register(); Drawer.Initialize(); Land.Initialize(Drawer); CreatureMgr.Initialize(Land, Drawer); God.Initialize(Land, Drawer); while (DX.CheckHitKey(DX.KEY_INPUT_ESCAPE) == 0 && DX.ScreenFlip() == 0 && DX.ProcessMessage() == 0 && DX.ClearDrawScreen() == 0) {//画面更新 & メッセージ処理 & 画面消去 Drawer.Update(); CreatureMgr.Update(); God.Update(); Land.Update(); Land.Draw(); CreatureMgr.Draw(); God.Draw(); } // DXライブラリの終了 DX.DxLib_End(); return; }
public Creature(CreatureMgr mgr, Gene gene, Nutrition nutrition) { this.mgr = mgr; Gene = gene; Size = gene.Size; MaxHP = gene.HP; HP = Program.Rand.Next(MaxHP); MaxNutrition = gene.Nutrition; Nutrition = nutrition; ActMgr.Initialize(this, TargetList, gene.ActList); Time = 0; Existence = true; Alive = true; Velocity = new Vector2D(); LastVelocityMultiplier = 60f / (float)mgr.TimerMax; Velocitycache = new Vector2D(); }
public Creature(CreatureMgr mgr, Gene gene) : this(mgr, gene, gene.Nutrition) { }
public Creature(CreatureMgr mgr) : this(mgr, new Gene()) { Position = new Vector2D(Program.Rand.Next(Program.World_X - 1), Program.Rand.Next(Program.World_Y - 1)); }
public Creature(CreatureMgr mgr, Creature parent) : this(mgr, new Gene(parent.Gene), parent.Nutrition.Copy()) { Position = parent.Position + new Vector2D(Program.Rand.Next(-20, 20), Program.Rand.Next(-20, 20)); }