Ejemplo n.º 1
0
        public My2DSpriteManager(Game_Logic GameLogic)
        {
            //Asination Logic Obj
            this.GameLogic = GameLogic;

            //Instantiate Texture for Menu
            CarsTextures = new Texture2D[8];

            //Instatiate For Pos Menu
            PosObjMenu = new Vector2[8];

            //instancio Texturas para Box Status
            BoxStatusTx = new Texture2D[3];

            MenusSprites      = new Texture2D[4];
            MenuMPlaySprites  = new Texture2D[3];
            MenuMPauseSprites = new Texture2D[2];
            MenuLevelsprites  = new Texture2D[3];
            MenuEndGame       = new Texture2D[3];
            MenuTourt         = new Texture2D[2];
            MenuHistory       = new Texture2D[8];
            Credits           = new Texture2D[3];

            Levelsprites = new Texture2D[3];
        }
Ejemplo n.º 2
0
        /// <summary>
        /// To initializa external Components like GoblinsXna
        /// </summary>
        protected override void Initialize()
        {
            int idx;

            //Init Console
            Console.WriteLine("CarGame AR: " + Version());
            Console.WriteLine(DateTime.Now.ToString() + " Loading game\n");

            // To initialize Xna
            base.Initialize();

            // Initialize the GoblinXNA framework
            State.InitGoblin(graphics, Content, "");

            // Initialize the scene graph
            scene = new Scene();

            /********* Init Content from Game *********/

            //Instantiate the Markers
            HinderMarkeNodes = new MarkerNode[Max_Markers];
            WeaponMarkeNodes = new MarkerNode[Max_palyer]; //One Weapon for Player

            //Instantiate Models
            Console.WriteLine(DateTime.Now.ToString() + " Loading Car´s Models\n");
            
            CarModels = new GeometryNode[Max_Models];
            ModelLoader loader = new ModelLoader();
            for (idx = 0; idx < Max_Models; idx++)
            {
                CarModels[idx] = new GeometryNode("CarModel" + idx.ToString());
                CarModels[idx].Model = (Model)loader.Load("Models", ModelsName[idx]);
                ((Model)CarModels[idx].Model).UseInternalMaterials = true;
            }

            //Instantiate the Logic Game
            GameLogic = new Game_Logic(Max_palyer);

            //Create Obj for Cars
            CarObjPhy = new RaceCar[Max_palyer];

            //Instancio los Obj de los obstaculos
            ObstModels = new GeometryNode[Max_Markers];

            //Instantiate the 2DManager
            My2Dmanager = new My2DSpriteManager(GameLogic);
            My2Dmanager.LoadContent();

            //Load SoundEffects
            GameLogic.SoundGame.SoundLoad();

            /******************************************/

            // Use the newton physics engine
            scene.PhysicsEngine = new NewtonPhysics();

            //Config Physics
            SetupPhysics();

#if USE_SOCKET_NETWORK
            //Init Network
            State.EnableNetworking = true;
            State.IsServer = true;
            ConfigServer(14242);
#endif

            State.ThreadOption = (ushort)ThreadOptions.MarkerTracking;

            // Setup and Create optical marker tracking
            SetupMarkerTracking();
            CreateMarkerTracking();

            // Enable shadow mapping
            scene.ShadowMap = new MultiLightShadowMap();

            //Instantiate the 3DManager
            Manager3D = new Graphics3D(groundMarkerNode, scene.ShadowMap);

            //Config Callbacks for Collitions
            ConfigCallBacks();

            // Set up the lights used in the scene
            CreateLights();

            // Create 3D objects
            CreateObjects();

            // Show Frames-Per-Second on the screen for debugging
            State.ShowFPS = true;
            //State.ShowTriangleCount = true;
            //State.ShowNotifications = true;
            // Make the debugging message fade out after 3000 ms (3 seconds)
            Notifier.FadeOutTime = 1000;

            Console.WriteLine(DateTime.Now.ToString() + " End Loading\n");

            //Server
            ServidorAr = new ARServer(GameLogic);
            ServidorAr.CallBackAddPlayer = AgregaPlayer;

#if INIT_SERVER
            ServidorAr.StartServer();
            //Add Ip Address
            My2Dmanager.ServerIp = ServidorAr.SetLocalIp();
#endif
            //Config Controls
            ConfigControls();
            if (CtrlPlayers[0] == Ctrl_Player.KEYBOARD)
                ServidorAr.AddPlayerOne();

#if USR_DEBUG
            //GameLogic.CurrentGameState = Game_Logic.Game_States.SEL_PLY;
            //GameLogic.StateScreen = Game_Logic.Game_SCR.GAME_LOADING;

            //GameLogic.AddPlayer("Player 2", 2);
            //GameLogic.Players[1].IsPlyOK = true;
            //GameLogic.Players[1].PlySelect = 7;
            //GameLogic.Players[1].IsDead = true;
            //GameLogic.AddPlayer("Player 3", 3);
            //GameLogic.AddPlayer("Player 4", 4);
#endif

        }
Ejemplo n.º 3
0
        private Color TxtTitleCol = Color.Black; //Color text

        #endregion Fields

        #region Constructors

        public My2DSpriteManager(Game_Logic GameLogic)
        {
            //Asination Logic Obj
            this.GameLogic = GameLogic;

            //Instantiate Texture for Menu
            CarsTextures = new Texture2D[8];

            //Instatiate For Pos Menu
            PosObjMenu = new Vector2[8];

            //instancio Texturas para Box Status
            BoxStatusTx = new Texture2D[3];

            MenusSprites = new Texture2D[4];
            MenuMPlaySprites = new Texture2D[3];
            MenuMPauseSprites = new Texture2D[2];
            MenuLevelsprites = new Texture2D[3];
            MenuEndGame = new Texture2D[3];
            MenuTourt = new Texture2D[2];
            MenuHistory = new Texture2D[8];
            Credits = new Texture2D[3];

            Levelsprites = new Texture2D[3];
        }
Ejemplo n.º 4
0
 public ARServer(Game_Logic GameLogic)
 {
     //Asination Logic Obj
     this.GameLogic = GameLogic;
 }