Пример #1
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
            int version = reader.ReadInt();

            switch ( version )
            {
                case 0:
                {
                    m_Corrosivity = reader.ReadInt();
                    m_Duration = reader.ReadInt();
                    int c = reader.ReadInt();
                    if ( c > 0 )
                    {
                        m_Effects = new Dictionary<CustomEffect, int>();
                        for ( int i = 0; i < c; i++ )
                            m_Effects.Add( (CustomEffect) reader.ReadInt(), reader.ReadInt() );
                    }

                    m_Timer = new WearOffTimer( this );
                    m_Timer.Start();
                    break;
                }

                case 1:
                {
                    m_MaxDuration = reader.ReadInt();
                    goto case 0;
                }
            }
        }
Пример #2
0
        public override void OnAttach()
        {
            if ( !(AttachedTo is BaseMeleeWeapon) )
                this.Delete();
            base.OnAttach();

            (AttachedTo as BaseWeapon).InvalidateProperties();

            if ( m_Timer == null )
            {
                m_Timer = new WearOffTimer( this );
                m_Timer.Start();
            }
        }