コード例 #1
0
ファイル: Game1.cs プロジェクト: er1/c376p1
        protected override void Initialize()
        {
            LIFE = 1000;

            worldHeight = graphics.PreferredBackBufferHeight;
            worldWidth = graphics.PreferredBackBufferWidth;
            map = new Map();
            #region Viewport stuff
            MainScreen = new Viewport();
            MainScreen.X = 0;
            MainScreen.Y = 0;
            MainScreen.Width = worldWidth;
            MainScreen.Height = worldHeight;
            MainScreen.MinDepth = 0;
            MainScreen.MaxDepth = 1;
            #endregion

            #region init Game components
            Components.Remove(cameraMain);
            Components.Remove(spriteManager);
            cameraMain = new Camera(this, new Vector3(0, 200, 199), new Vector3(0, -5, 1), Vector3.Up, MainScreen, true, worldSize);
            spriteManager = new SpriteManager(this);
            Components.Add(cameraMain);
            Components.Add(spriteManager);
            #endregion

            chosenTile = cameraMain.getCurrentTC();
            this.IsFixedTimeStep = false;
            this.TargetElapsedTime = new TimeSpan(0, 0, 0, 0, 20);

            // resource management
            resourcemanager = new ResourceManager();
            gatherzone = new GatherZone(resourcemanager, this);

            base.Initialize();
        }
コード例 #2
0
ファイル: tower.cs プロジェクト: er1/c376p1
 public bool lookForTarget(Map mainMap)
 {
     map = mainMap;
     for (int i = 0; i < range; i++)
     {
         TileCoord test = tc;
         test.x -= i;
         if (map.GetTile(test).anyMonster())
         {
             currentTargetTC = test;
              return true;
         }
     }
     return false;
 }