コード例 #1
0
 // Use this for initialization
 void Awake()
 {
     control    = this;
     gridSet    = false;
     xRows      = Field.GetComponent <MeshRenderer>().bounds.size.x + 1f;
     zRows      = Field.GetComponent <MeshRenderer>().bounds.size.z + 1f;
     initialPos = new Vector3(0f, -0.25f, 0f);
     addXRow    = new Vector3(1f, 0f, 0f);
     resetXRow  = new Vector3(xRows, 0f, 0f);
     addZRow    = new Vector3(0f, 0f, 1f);
 }
コード例 #2
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
コード例 #3
0
    void Start()
    {
        moveGrid = FindObjectOfType <MovementGrid>();
        clock    = FindObjectOfType <GameClock>();

        clock.registerListener(this);

        if (moveToPoint != null)
        {
            transform.position = moveToPoint.transform.position;
            posX = moveToPoint.X;
            posY = moveToPoint.Y;
        }
    }
コード例 #4
0
 public ObjectManager(SpriteFont spriteFont, List <Texture2D> Projectile, MovementGrid grid)
 {
     Grid         = grid;
     SpriteFont   = spriteFont;
     btnDown      = false;
     btnRightDown = false;
     AddLst       = new List <GameObject>();
     plist        = new List <Projectile>();
     RemoveLst    = new List <GameObject>();
     projectiles  = Projectile;
     MageLst      = new List <MageTower>();
     ArcherLst    = new List <ArcherTower>();
     skellyList   = new List <Skeleton>();
 }
コード例 #5
0
 public void Start()
 {
     moveGrid           = FindObjectOfType <MovementGrid>();
     transform.position = moveGrid.getPosition(X, Y);
 }
コード例 #6
0
        public void loadObjMan()
        {
            MapGridBlock = Content.Load <Texture2D>(@"MapParts\OmniRax-Map_Entarya");
            Grid         = new MovementGrid(GameRef.ScreenRectangle, 32, 32, MapGridBlock, Level);
            BaseGrid     = Grid.SourceList;
            ObjManager   = new OmniLibrary.ObjectManager(base.menuFont, lstTexMageProjectile, Grid, lstTexCoins);
            if (Level == 0)
            {
                //LandScape = new MapLandscape(lstTexMaps[0], GameRef.ScreenRectangle, 0, spawn, waypoints);
            }
            else if (Level == 1)
            {
                //LandScape = new MapLandscape(lstTexMaps[1], lstTexMaps[2], GameRef.ScreenRectangle, 0, spawn, waypoints);
            }
            else if (Level == 2)
            {
                //LandScape = new MapLandscape(lstTexMaps[3], lstTexMaps[4], GameRef.ScreenRectangle, 0, spawn, waypoints);
            }
            else if (Level == 3)
            {
                //LandScape = new MapLandscape(lstTexMaps[5], lstTexMaps[6], GameRef.ScreenRectangle, 0, spawn, waypoints);
            }

            texGameOver               = Content.Load <Texture2D>(@"Ui Content\GameOver 1");
            pbGameOver                = new PictureBox(texGameOver, GameRef.ScreenRectangle, 1, 1, 0);
            pbGameOver.obj_Selected  += new EventHandler(YouLose);
            pbGameOver.obj_MouseOver += new EventHandler(pbExit_obj_MouseOver);
            pbGameOver.obj_Leave     += new EventHandler(pbExit_obj_Leave);
            texExit                     = Content.Load <Texture2D>(@"Ui Content\GamePlay\Exit");
            pbExit                      = new PictureBox(texExit, new Rectangle(GameRef.ScreenRectangle.Width - texExit.Width / 2 - 70, 0, 70, 70), 1, 1, 1);
            pbExit.obj_Selected        += new EventHandler(pbExit_obj_Selected);
            pbExit.obj_MouseOver       += new EventHandler(pbExit_obj_MouseOver);
            pbExit.obj_Leave           += new EventHandler(pbExit_obj_Leave);
            pbVictory                   = new PictureBox(texVictory, GameRef.ScreenRectangle, 1, 1, 0);
            pbVictory.obj_Win          += new EventHandler(pbVictory_obj_Win);
            pbVictory.obj_Selected     += new EventHandler(YouLose);
            pbVictory.obj_MouseOver    += new EventHandler(pbExit_obj_MouseOver);
            pbVictory.obj_Leave        += new EventHandler(pbExit_obj_Leave);
            pbVictory.Visable           = false;
            pbVictory.IsEnabled         = false;
            pbUiTutorial                = new PictureBox(texUiTutor, new Rectangle(GameRef.ScreenRectangle.Width - texExit.Width / 2, 0, 70, 70), 1, 1, 1);
            pbUiTutorial.obj_MouseOver += new EventHandler(pbExit_obj_MouseOver);
            pbUiTutorial.obj_Leave     += new EventHandler(pbExit_obj_Leave);
            pbUiTutorial.obj_Selected  += new EventHandler(pbUiTutorial_obj_Selected);


            StatusBar        = new StatusBar(texStatusBar, 5, 1, new Rectangle(0, GameRef.ScreenRectangle.Height - 50, 400, 50));
            StatusBar.Gold   = GameRef.player.gold;
            StatusBar.Health = 10;
            StatusBar.Font   = Content.Load <SpriteFont>(@"Fonts\HudFont");



            ObjManager.AddLst.Add(LandScape);
            ObjManager.AddLst.Add(StatusBar);
            ObjManager.AddLst.Add(pbExit);
            ObjManager.AddLst.Add(pbUiTutorial);
            //line = Content.Load<Texture2D>(@"MapParts\line");
            AddPlots(Content);
            //LoadWave();
            ObjManager.AddLst.Add(pbVictory);
        }