コード例 #1
0
        public override void AddComponent(IComponent c)
        {
            base.AddComponent(c);
            ServerCharacterComponent com = c as ServerCharacterComponent;

            if (com != null)
            {
                Stats.UpdateWithValues(com.AddedStats);

                if (com.AddedProperties != null)
                {
                    // initial copy of properties
                    Properties.UpdateWithValues(com.AddedProperties);

                    // be notified of future updates. Two-way binding
                    com.AddedProperties.SubscribeToChangeNotifications(this);
                    Properties.SubscribeToChangeNotifications(com);
                }

                if (com.AddedStats != null)
                {
                    // initial copy of properties
                    Stats.UpdateWithValues(com.AddedStats);

                    // be notified of future updates. Two-way binding.
                    com.AddedStats.SubscribeToChangeNotifications(this);
                    Stats.SubscribeToChangeNotifications(com);
                }
            }
        }
コード例 #2
0
 public ServerGameObject() : base()
 {
     Properties.SubscribeToChangeNotifications(this);
     Stats.SubscribeToChangeNotifications(this);
     IsTransient = true;
     IsZombie    = false;
     Version     = 0;
 }