Esempio n. 1
0
            public PlayerResourcePropertyMonitor(string propertyName, Player player, Func <object, T> decoder)
            {
                ValueChanged.Add(self => ((IPropertyMonitor)self).ValueChanged.Invoke(self));
                ValueChanged.Add(self => ((IPropertyMonitor <T>)self).ValueChanged.Invoke(self));
                ValueChanged.Add(self => ((IEntityPropertyMonitor)self).ValueChanged.Invoke(self));
                ValueChanged.Add(self => ((IEntityPropertyMonitor <T>)self).ValueChanged.Invoke(self));
                ValueChanged.Add(self => ((IPlayerPropertyMonitor)self).ValueChanged.Invoke(self));

                PropertyName = propertyName;
                Player       = player;
                Decoder      = decoder;

                PlayerResourceEntity = player.World.Entities.Single(e => e?.Class.Classname == "CTFPlayerResource");

                string specificProperty = string.Format("{0}.{1:D3}", PropertyName, Player.EntityIndex);

                var props = PlayerResourceEntity.Properties.Select(prop => prop.Definition.FullName.Remove(prop.Definition.FullName.Length - 4))
                            .Except("m_iHealth")
                            .Except("m_iPing")
                            .Except("m_iScore")
                            .Except("m_iDeaths")
                            .Except("m_bConnected")
                            .Except("m_iTeam")
                            .Except("m_bAlive")
                            .Distinct();

                InternalPropertyMonitor = new EntityPropertyMonitor <T>(specificProperty, PlayerResourceEntity, Decoder);
                InternalPropertyMonitor.ValueChanged.Add(InternalValueChanged);
            }
Esempio n. 2
0
        public Entity(WorldState ws, ServerClass sClass, SendTable table, uint index, uint serialNumber)
        {
            m_World        = ws;
            m_Class        = sClass;
            m_NetworkTable = table;
            m_Index        = index;
            m_SerialNumber = serialNumber;

            Team  = new EntityPropertyMonitor <Team?>("DT_BaseEntity.m_iTeamNum", this, o => (Team)(int)o);
            Owner = new EntityPropertyMonitor <EHandle>("DT_BaseEntity.m_hOwnerEntity", this, o => new EHandle(ws, (uint)o));
        }
Esempio n. 3
0
 public TFRocket(Entity e) : base(e, "CTFProjectile_Rocket")
 {
     Position = new EntityPropertyMonitor <Vector>("DT_TFBaseRocket.m_vecOrigin", Entity, o => (Vector)o);
     Angle    = new EntityPropertyMonitor <Vector>("DT_TFBaseRocket.m_angRotation", Entity, o => (Vector)o);
     Launcher = new EntityPropertyMonitor <EHandle>("DT_TFBaseRocket.m_hLauncher", Entity, o => new EHandle(e.World, (uint)o));
 }