Ejemplo n.º 1
0
 public WorldProperty(WorldProperty property, PropertyValue overwriteValue)
 {
     ObjectID = property.ObjectID;
     Property = property.Property;
     Key      = property.Key;
     Value    = overwriteValue;
 }
Ejemplo n.º 2
0
        public void SetState(WorldProperty property)
        {
            switch (property.Property)
            {
            case EProperty.MoneyEqual:
                _money[property.ObjectID] = property.Value.iVal;
                return;

            case EProperty.MoneyGreaterThan:
                _money[property.ObjectID] = property.Value.iVal + 1;
                return;

            case EProperty.MoneyLessThan:
                _money[property.ObjectID] = property.Value.iVal - 1;
                return;
            }

            int toUpdate = _worldProperties.FindIndex(prop => prop.Key == property.Key);

            if (toUpdate != -1)
            {
                _worldProperties[toUpdate] = new WorldProperty(_worldProperties[toUpdate], property.Value);
            }
            else
            {
                _worldProperties.Add(property);
            }
        }
Ejemplo n.º 3
0
        public void FromRuntimeProperty(WorldProperty property, bool generateGuid)
        {
            _objectType  = property.GetObjectClass();
            _objectIndex = property.GetClassIndex();

            Property = property.Property;

            iValue = property.Value.iVal;
            bValue = property.Value.bVal;
            fValue = property.Value.fVal;
            if (generateGuid)
            {
#if UNITY_EDITOR
                guid = GUID.Generate().ToString();
#else
                Debug.LogError("Can't generate guid in a build");
#endif //UNITY_EDITOR
            }
        }
Ejemplo n.º 4
0
        public bool IsInState(WorldProperty property)
        {
            if (property.Property == EProperty.MoneyEqual || property.Property == EProperty.MoneyGreaterThan || property.Property == EProperty.MoneyLessThan)
            {
                return(Query(property.Key, null, property.Value));
            }

            List <WorldProperty> propertiesWithID = _worldProperties.FindAll(prop => prop.ObjectID == property.ObjectID);

            if (propertiesWithID.Count > 0)
            {
                foreach (WorldProperty withID in propertiesWithID)
                {
                    if (withID.Property == property.Property)
                    {
                        return(Query(withID.Key, withID.Value, property.Value));
                    }
                }
            }

            return(false);
        }
Ejemplo n.º 5
0
 public PropertyValue(WorldProperty worldProperty)
 {
     iVal = worldProperty.Value.iVal;
     bVal = worldProperty.Value.bVal;
     fVal = worldProperty.Value.fVal;
 }
Ejemplo n.º 6
0
 public PropertyKey(WorldProperty worldProperty)
 {
     ObjectID  = worldProperty.ObjectID;
     _property = (int)worldProperty.Property;
 }
Ejemplo n.º 7
0
 public void SetState(WorldProperty property)
 {
     _state.SetState(property);
 }
Ejemplo n.º 8
0
 public bool IsInState(WorldProperty property)
 {
     return(_state.IsInState(property));
 }