public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadEncodedInt(); switch (version) { case 1: { m_ForceDeactivate = reader.ReadBool(); goto case 0; } case 0: { int length = reader.ReadEncodedInt(); m_Spawners = new CreatureSpawner[length]; for (int i = 0; i < length; i++) { m_Spawners[i] = reader.ReadItem <CreatureSpawner>(); } break; } } m_Instance = this; m_SpawnTimer = new InternalTimer(this); m_SpawnTimer.Start(); }
public static bool Create() { if (m_Instance != null && !m_Instance.Deleted) { return(false); } m_Instance = new ArisenController(); return(true); }
public static bool Create() { if (m_Instance != null && !m_Instance.Deleted) { return(false); } m_Instance = new ArisenController(); WeakEntityCollection.Add("sa", m_Instance); return(true); }
public static bool Remove() { if (m_Instance == null) { return(false); } m_Instance.Delete(); m_Instance = null; return(true); }
public override void OnDelete() { base.OnDelete(); if (m_SpawnTimer != null) { m_SpawnTimer.Stop(); m_SpawnTimer = null; } foreach (XmlSpawner spawner in m_Spawners) { spawner.Delete(); } m_Instance = null; }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadEncodedInt(); switch (version) { case 1: { m_ForceDeactivate = reader.ReadBool(); goto case 0; } case 0: { int length = reader.ReadEncodedInt(); m_Spawners = new XmlSpawner[length]; for (int i = 0; i < length; i++) { var spawner = reader.ReadItem <XmlSpawner>(); if (spawner == null) { spawner = m_Entries[i].CreateSpawner(); spawner.SmartSpawning = true; } m_Spawners[i] = spawner; } break; } } m_Instance = this; m_SpawnTimer = new InternalTimer(this); m_SpawnTimer.Start(); }
public InternalTimer(ArisenController controller) : base(TimeSpan.Zero, TimeSpan.FromSeconds(5.0)) { m_Controller = controller; }
public static bool Create() { if ( m_Instance != null && !m_Instance.Deleted ) return false; m_Instance = new ArisenController(); return true; }
public InternalTimer( ArisenController controller ) : base(TimeSpan.Zero, TimeSpan.FromSeconds( 5.0 )) { m_Controller = controller; }
public override void OnDelete() { base.OnDelete(); if ( m_SpawnTimer != null ) { m_SpawnTimer.Stop(); m_SpawnTimer = null; } foreach ( CreatureSpawner spawner in m_Spawners ) spawner.Delete(); m_Instance = null; }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadEncodedInt(); switch ( version ) { case 1: { m_ForceDeactivate = reader.ReadBool(); goto case 0; } case 0: { int length = reader.ReadEncodedInt(); m_Spawners = new CreatureSpawner[length]; for ( int i = 0; i < length; i++ ) m_Spawners[i] = reader.ReadItem<CreatureSpawner>(); break; } } m_Instance = this; m_SpawnTimer = new InternalTimer( this ); m_SpawnTimer.Start(); }
public static bool Remove() { if ( m_Instance == null ) return false; m_Instance.Delete(); m_Instance = null; return true; }