示例#1
0
        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();
        }
示例#2
0
        public static bool Create()
        {
            if (m_Instance != null && !m_Instance.Deleted)
            {
                return(false);
            }

            m_Instance = new ArisenController();
            return(true);
        }
示例#3
0
        public static bool Create()
        {
            if (m_Instance != null && !m_Instance.Deleted)
            {
                return(false);
            }

            m_Instance = new ArisenController();
            WeakEntityCollection.Add("sa", m_Instance);
            return(true);
        }
示例#4
0
        public static bool Remove()
        {
            if (m_Instance == null)
            {
                return(false);
            }

            m_Instance.Delete();
            m_Instance = null;

            return(true);
        }
示例#5
0
        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;
        }
示例#6
0
        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();
        }
示例#7
0
 public InternalTimer(ArisenController controller)
     : base(TimeSpan.Zero, TimeSpan.FromSeconds(5.0))
 {
     m_Controller = controller;
 }
示例#8
0
        public static bool Create()
        {
            if ( m_Instance != null && !m_Instance.Deleted )
                return false;

            m_Instance = new ArisenController();
            return true;
        }
示例#9
0
 public InternalTimer( ArisenController controller )
     : base(TimeSpan.Zero, TimeSpan.FromSeconds( 5.0 ))
 {
     m_Controller = controller;
 }
示例#10
0
        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;
        }
示例#11
0
        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();
        }
示例#12
0
        public static bool Remove()
        {
            if ( m_Instance == null )
                return false;

            m_Instance.Delete();
            m_Instance = null;

            return true;
        }