コード例 #1
0
 public VBFactionManager()
 {
     if (instance != null)
     {
         Log.Fatal("RTSFactionManager: instance != null");
     }
     instance = this;
 }
コード例 #2
0
 /// <summary>Overridden from <see cref="Engine.EntitySystem.Entity.OnPostCreate(Boolean)"/>.</summary>
 protected override void OnPostCreate(bool loaded)
 {
     if (instance == this)             //for undo support
     {
         instance = this;
     }
     base.OnPostCreate(loaded);
 }
コード例 #3
0
        /// <summary>Overridden from <see cref="Engine.EntitySystem.Entity.OnDestroy()"/>.</summary>
        protected override void OnDestroy()
        {
            base.OnDestroy();

            if (instance == this)             //for undo support
            {
                instance = null;
            }
        }
コード例 #4
0
        /// <summary>Overridden from <see cref="Engine.EntitySystem.Entity.OnPostCreate2(bool)"/>.</summary>
        protected override void OnPostCreate2(bool loaded)
        {
            base.OnPostCreate2(loaded);

            GameWorld gameWorld = Parent as GameWorld;

            if (gameWorld != null)
            {
                gameWorld.DoActionsAfterMapCreated();
            }

            UpdateWindSpeedSettings();

            // VB: create player and VBFactionManager
            if (GameMap.Instance.GameType == GameMap.GameTypes.VanBuren && EntitySystemWorld.Instance.IsServer() || EntitySystemWorld.Instance.IsSingle())
            {
                if (VBFactionManager.Instance == null)
                {
                    VBFactionManager manager = (VBFactionManager)Entities.Instance.Create("VBFactionManager", this);
                    manager.PostCreate();
                }
            }
        }