コード例 #1
0
 public SpawnInfo(MyObjectBuilder_SpaceFaunaComponent.SpawnInfo info, int currentTime)
 {
     SpawnTime = currentTime + info.SpawnTime;
     AbandonTime = currentTime + info.SpawnTime;
     Position = new Vector3D(info.X, info.Y, info.Z);
     Planet = MyGamePruningStructure.GetClosestPlanet(Position);
     SpawnDone = false;
 }
コード例 #2
0
 public SpawnInfo(MyObjectBuilder_SpaceFaunaComponent.SpawnInfo info, int currentTime)
 {
     SpawnTime = currentTime + info.SpawnTime;
     AbandonTime = currentTime + info.SpawnTime;
     Position = new Vector3D(info.X, info.Y, info.Z);
     Planet = MyGravityProviderSystem.GetNearestPlanet(Position);
     SpawnDone = false;
 }
コード例 #3
0
        public override void BeforeStart()
        {
            base.BeforeStart();

            if (m_obForLoading == null) return;

            int currentTime = MySandboxGame.TotalGamePlayTimeInMilliseconds;

            m_allSpawnInfos.Capacity = m_obForLoading.SpawnInfos.Count;
            foreach (var info in m_obForLoading.SpawnInfos)
            {
                var spawnInfo = new SpawnInfo(info, currentTime);
                m_allSpawnInfos.Add(spawnInfo);
                m_spawnInfoGrid.AddPoint(ref spawnInfo.Position, spawnInfo);
            }

            m_allTimeoutInfos.Capacity = m_obForLoading.TimeoutInfos.Count;
            foreach (var info in m_obForLoading.TimeoutInfos)
            {
                var timeoutInfo = new SpawnTimeoutInfo(info, currentTime);
                if (timeoutInfo.AnimalSpawnInfo == null) // do not add invalid timeout objects
                    continue;
                m_allTimeoutInfos.Add(timeoutInfo);
                m_timeoutInfoGrid.AddPoint(ref timeoutInfo.Position, timeoutInfo);
            }

            m_obForLoading = null;
        }
コード例 #4
0
        public override void Init(MyObjectBuilder_SessionComponent sessionComponent)
        {
            base.Init(sessionComponent);

            m_obForLoading = sessionComponent as MyObjectBuilder_SpaceFaunaComponent;
        }
コード例 #5
0
 public SpawnTimeoutInfo(MyObjectBuilder_SpaceFaunaComponent.TimeoutInfo info, int currentTime)
 {
     TimeoutTime = currentTime + info.Timeout;
     Position = new Vector3D(info.X, info.Y, info.Z);
     var planet = MyGamePruningStructure.GetClosestPlanet(Position);
     AnimalSpawnInfo = MySpaceBotFactory.GetDayOrNightAnimalSpawnInfo(planet, Position);
     if (AnimalSpawnInfo == null)
     {
         TimeoutTime = currentTime;
     }
 }
コード例 #6
0
 public SpawnTimeoutInfo(MyObjectBuilder_SpaceFaunaComponent.TimeoutInfo info, int currentTime)
 {
     TimeoutTime = currentTime + info.Timeout;
     Position = new Vector3D(info.X, info.Y, info.Z);
     var planet = MyGravityProviderSystem.GetNearestPlanet(Position);
     AnimalSpawnInfo = MySpaceBotFactory.GetDayOrNightAnimalSpawnInfo(planet, Position);
     if (AnimalSpawnInfo == null)
     {
         TimeoutTime = currentTime;
     }
 }