Esempio n. 1
0
        public Entity(SerializationInfo info, StreamingContext cntxt) : base(info, cntxt)
        {
            Name      = (string)info.GetValue("Entity_Name", typeof(string));
            Equipment = (Equipment)info.GetValue("Entity_Equipment", typeof(Equipment));
            Stats     = (EntityStats)info.GetValue("Entity_Stats", typeof(EntityStats));
            XPValue   = (int)info.GetValue("Entity_XPValue", typeof(int));
            facing    = (Direction)info.GetValue("Entity_Facing", typeof(Direction));
            MAX_SPEED = (float)info.GetValue("Entity_MaxSpeed", typeof(float));
            msVel     = (Vector2)info.GetValue("Entity_MsVel", typeof(Vector2));
            bounds    = (EntityBounds)info.GetValue("Entity_EBounds", typeof(EntityBounds));
            State     = (EntityState)info.GetValue("Entity_State", typeof(EntityState));

            // Init entity in loaded classes
            Stats.setEntity(this);
            EBounds.setEntity(this);
            Equipment.setEntity(this);

            // Un-saved values
            GScreen         = (GameScreen)ScreenManager.getScreen(ScreenId.Game);
            lastHitPart     = EntityPart.Body;
            jumpDelay       = attackDelay = showHpTicks = 0;
            speedMultiplier = MAX_SPEED;
            pDrops          = new PossibleDrop[0];
            sprite.setFrame(250, 3);
        }
Esempio n. 2
0
        public Entity(SerializationInfo info, StreamingContext cntxt) : base(info, cntxt)
        {
            Name       = (string)info.GetValue("Name", typeof(string));
            Equipment  = (Equipment)info.GetValue("Equipment", typeof(Equipment));
            Stats      = (EntityStats)info.GetValue("Stats", typeof(EntityStats));
            facing     = (Direction)info.GetValue("Facing", typeof(Direction));
            Bounds     = (EntityBounds)info.GetValue("EBounds", typeof(EntityBounds));
            State      = (EntityState)info.GetValue("State", typeof(EntityState));
            Properties = (Dictionary <string, bool>)info.GetValue("Props", typeof(Dictionary <string, bool>));

            // Init entity in loaded classes
            Stats.setEntity(this);
            EBounds.setEntity(this);
            Equipment.setEntity(this);

            // Un-saved values
            commonEntityInit();
        }