/// <summary>
 /// Add new component into container and register to gs manager
 /// </summary>
 /// <typeparam name="T">component type</typeparam>
 /// <param name="gsMgr">game source manager</param>
 /// <returns>added component</returns>
 public T AddComponent <T>(GameSourceManager gsMgr) where T : Component, new()
 {
     lock (components)
     {
         // create component and initialize with gsMgr and SID
         T component = gsMgr.Create <T>();
         component.gameObject = owner;
         component.transform  = owner.transform;
         components.Add(component);
         return(component);
     }
 }
Пример #2
0
        public Game(string name, IDebugger debugger)
        {
            GameId                  = idPool.NewID();
            GameName                = name;
            Debugger                = debugger;
            physicEngine            = new BulletEngine.BulletPhysicEngine(debugger);
            gameSourceManager       = new GameSourceManager(this, physicEngine, debugger);
            mainScene               = new Scene(gameSourceManager, debugger);
            peerGroup               = new PeerGroup(FormmaterSerializer.GetInstance(), debugger);
            peerGroup.OperationCode = SimpleGameMetrics.OperationCode.Game;

            looper            = new LogicLooper(60f);
            looper.OnUpdated += GameLoop;

            status = GameStatus.WaitToInitialize;
        }
Пример #3
0
 public Scene(PhysicEngineProxy physicEngine, IDebugger debugger)
 {
     Debugger     = debugger;
     PhysicEngine = physicEngine;
     GSManager    = new GameSourceManager(PhysicEngine, Debugger);
 }
Пример #4
0
 public Scene(GameSourceManager gsManager, IDebugger debugger)
 {
     Debugger  = debugger;
     GSManager = gsManager;
 }