public static void InitLoad(TerrainData worlddata, EntitiesData entitiesdata) { InitBefore(); #region Terrain Terrain.Load(worlddata); Terrain.Init(); #endregion #region Entities EntityManager.Init(); //load other entities foreach (var e in entitiesdata.entities) { EntityManager.AddEntity(e); e.InitTimers(); } #endregion #region Player //load player data Player.LoadPlayer(entitiesdata.player); EntityManager.AddEntity(Player.Instance); //load player inventory PlayerInventory.Init(); PlayerInventory.Instance.LoadItems(entitiesdata.playerItems); #endregion }
public static void InitNew(int seed) { InitBefore(); Terrain.CreateNew(seed); Terrain.Init(); EntityManager.Init(); Player.CreateNew(); EntityManager.AddEntity(Player.Instance); Player.Instance.CorrectTerrainCollision(); PlayerInventory.Init(); PlayerInventory.Instance.LoadDefaultItems(); //for (int i = 1; i <= 300; i++) { // Shooter s = new Shooter(new Vector2(i * 20 * MathUtil.RandFloat(Program.Rand, 0.8f, 1.2f), 0), 100, 250); // EntityManager.AddEntity(s); // s.CorrectTerrainCollision(); // Squisher sq = new Squisher(new Vector2(i * 20 * MathUtil.RandFloat(Program.Rand, 0.8f, 1.2f), 0)); // EntityManager.AddEntity(sq); // sq.CorrectTerrainCollision(); //} }
public override void _Ready() { // Runtime DB Init var err = DB.Init(); if (err != null) { Dbg.LogErr("DB Init: ", err); return; } Dbg.LogSucc("DB Init: Success!"); // Game Handlers Init err = HandlerInit(); if (err != null) { Dbg.LogErr("Handler Init: ", err); return; } Dbg.LogSucc("Handlers Init: Success!"); // Entity Manager Init err = EntityManager.Init(); if (err != null) { Dbg.LogErr("Entity Manager Init: ", err); return; } Dbg.LogSucc("Entity Manager Init: Success!"); // TCP Client ClientTCP.Init(installToken, headerSize); err = ClientTCP.AuthOnServer(authIP, authPort); if (err != null) { Dbg.LogErr("Auth Failed: ", err); return; } Dbg.LogSucc("Auth Success"); }