Esempio n. 1
0
 private void AddAttribute(Attribute.AttributeType type, int val)
 {
     _attrs.Add(new Attribute {
         Type  = type,
         Value = val
     });
 }
Esempio n. 2
0
        public static Variable Draw(Attribute.AttributeType type, Rect size, Variable Value)
        {
            switch (type)
            {
            case Attribute.AttributeType.Value:
                return(Value.Set(EditorGUI.FloatField(size, "<>", Value.GetFloat())));

            case Attribute.AttributeType.Word:
                return(Value.Set(EditorGUI.TextField(size, "", Value.GetString())));

            case Attribute.AttributeType.Conditionals:
                return(IfCharacterFilter(size, Value));

            case Attribute.AttributeType.Then:
                return(ThenCharacterFilter(size, Value));

            case Attribute.AttributeType.Else:
                return(ElseCharacterFilter(size, Value));

            case Attribute.AttributeType.NoteField:
                return(Value.Set(EditorGUI.TextArea(new Rect(0, 20, 120, 100), Value.GetString(), GUI.skin.GetStyle("VCS_StickyNote"))));

            case Attribute.AttributeType.ReadOnlyValue:
                EditorGUI.LabelField(size, Value.GetString());
                return(Value);

            case Attribute.AttributeType.ReadOnlyXValue:
                EditorGUI.LabelField(size, Value.GetString());
                return(Value);

            case Attribute.AttributeType.ReadOnlyYValue:
                EditorGUI.LabelField(size, Value.GetString());
                return(Value);

            case Attribute.AttributeType.ReadOnlyZValue:
                EditorGUI.LabelField(size, Value.GetString());
                return(Value);

            case Attribute.AttributeType.ReadOnlyValueR:
                EditorGUI.LabelField(size, Value.GetString());
                return(Value);

            case Attribute.AttributeType.ReadOnlyValueG:
                EditorGUI.LabelField(size, Value.GetString());
                return(Value);

            case Attribute.AttributeType.ReadOnlyValueB:
                EditorGUI.LabelField(size, Value.GetString());
                return(Value);

            case Attribute.AttributeType.ReadOnlyValueA:
                EditorGUI.LabelField(size, Value.GetString());
                return(Value);

            default:
                return(Value);
            }
        }
Esempio n. 3
0
        public static Variable Reset(Attribute.AttributeType type, Variable Value)
        {
            switch (type)
            {
            case Attribute.AttributeType.Value:
                return(Value);

            case Attribute.AttributeType.Word:
                return(Value.Set(Value.GetString()));

            case Attribute.AttributeType.Conditionals:
                return(Value.Set(Value.GetString()));

            case Attribute.AttributeType.Then:
                return(Value.Set(Value.GetString()));

            case Attribute.AttributeType.Else:
                return(Value.Set(Value.GetString()));

            case Attribute.AttributeType.NoteField:
                return(Value.Set(Value.GetString()));

            case Attribute.AttributeType.ReadOnlyValue:
                Value.Set(0);
                return(Value);

            case Attribute.AttributeType.ReadOnlyXValue:
                Value.Set("X");
                return(Value);

            case Attribute.AttributeType.ReadOnlyYValue:
                Value.Set("Y");
                return(Value);

            case Attribute.AttributeType.ReadOnlyZValue:
                Value.Set("Z");
                return(Value);

            case Attribute.AttributeType.ReadOnlyValueR:
                Value.Set("R");
                return(Value);

            case Attribute.AttributeType.ReadOnlyValueG:
                Value.Set("G");
                return(Value);

            case Attribute.AttributeType.ReadOnlyValueB:
                Value.Set("B");
                return(Value);

            case Attribute.AttributeType.ReadOnlyValueA:
                Value.Set("A");
                return(Value);

            default:
                return(Value);
            }
        }
 public void ChangeAttributeValue(Attribute.AttributeType type, int amount)
 {
     foreach (Attribute att in ourCharacter.attributes)
     {
         if (att.type == type)
         {
             att.amount += amount;
             AttributeTextItems[(int)type].text = att.type.ToString() + " " + amount;
         }
     }
 }
Esempio n. 5
0
        public Attribute AddAttribute(Variable value, Attribute.AttributeType type, string description, Attribute.OnAttributeChanged onAttributeChanged)
        {
            if (Attributes == null)
            {
                Attributes = new List <Attribute>();
            }

            var newAttribute = new Attribute(type);

            newAttribute.Value = value;
            Attributes.Add(newAttribute);
            return(newAttribute);
        }
Esempio n. 6
0
        public void AddToGrowth(Attribute.AttributeType type, int value)
        {
            Growths = Growths.Select((growth => {
                if (growth.Type == type)
                {
                    return(new Growth {
                        Type = type,
                        Value = Math.Min(GrowthMax, growth.Value + value)
                    });
                }

                return(growth);
            })).ToHashSet();
        }
Esempio n. 7
0
        public void AddToAttribute(Attribute.AttributeType type, int value)
        {
            Attributes = Attributes.Select((attribute => {
                if (attribute.Type == type)
                {
                    return(new Attribute {
                        Type = type,
                        Value = Math.Min(AttributeMax, attribute.Value + value)
                    });
                }

                return(attribute);
            })).ToHashSet();
        }
Esempio n. 8
0
        private Dictionary <Attribute.AttributeType, AttributeBuff> ConstructBuff(string[] infos)
        {
            var buffTable = new Dictionary <Attribute.AttributeType, AttributeBuff>();

            for (int i = 5; i < infos.Length; i += 5)
            {
                Attribute.AttributeType  attributeType = (Attribute.AttributeType) int.Parse(infos[i]);
                AttributeBuff.BuffTarget buffTarget    = (AttributeBuff.BuffTarget) int.Parse(infos[i + 1]);
                AttributeBuff.BuffType   buffType      = (AttributeBuff.BuffType) int.Parse(infos[i + 2]);
                int   value   = int.Parse(infos[i + 3]);
                float seconds = float.Parse(infos[i + 4]);
                buffTable.Add(attributeType, new AttributeBuff(buffTarget, buffType, value, seconds));
            }
            return(buffTable);
        }
        public AttributeData(Attribute.AttributeType _type, Variable variable)
        {
            if (_type == Attribute.AttributeType.Value)
            {
                Value = new Variable().Set(variable.GetFloat());
            }
            else if (_type == Attribute.AttributeType.Word)
            {
                Value = new Variable().Set(variable.GetString());
            }
            else
            {
                Value = new Variable().Set(variable.GetString());
            }

            Type = _type;
        }
Esempio n. 10
0
        public Attribute GetAttribute(Attribute.AttributeType type)
        {
            var baseAttr = _character.Attributes.First(attr => attr.Type == type);

            return(AttributeUtils.ApplyBuffs(baseAttr, Buffs.Concat(_temporaryBuffs)));
        }
        public static Variable Draw(Attribute.AttributeType type, Rect size, Rect attributeArea, Variable Value)
        {
            switch (type)
            {
            case Attribute.AttributeType.Value:
                return(Value.Set(EditorGUI.FloatField(size, "<>", Value.GetFloat())));

            case Attribute.AttributeType.Word:
                return(Value.Set(EditorGUI.TextField(size, "", Value.GetString())));

            case Attribute.AttributeType.Conditionals:
                return(IfCharacterFilter(size, Value));

            case Attribute.AttributeType.Then:
                return(ThenCharacterFilter(size, Value));

            case Attribute.AttributeType.Else:
                return(ElseCharacterFilter(size, Value));

            case Attribute.AttributeType.NoteField:
                GUI.color = Color.yellow;
                var textAreaValue = Value.Set(EditorGUI.TextArea(attributeArea, Value.GetString()));
                GUI.color = Color.white;
                //noteSkin.alignment = TextAnchor.UpperLeft;
                return(textAreaValue);

            case Attribute.AttributeType.ReadOnlyValue:
                EditorGUI.LabelField(size, Value.GetString());
                return(Value);

            case Attribute.AttributeType.ReadOnlyXValue:
                EditorGUI.LabelField(size, Value.GetString());
                return(Value);

            case Attribute.AttributeType.ReadOnlyYValue:
                EditorGUI.LabelField(size, Value.GetString());
                return(Value);

            case Attribute.AttributeType.ReadOnlyZValue:
                EditorGUI.LabelField(size, Value.GetString());
                return(Value);

            case Attribute.AttributeType.ReadOnlyValueR:
                EditorGUI.LabelField(size, Value.GetString());
                return(Value);

            case Attribute.AttributeType.ReadOnlyValueG:
                EditorGUI.LabelField(size, Value.GetString());
                return(Value);

            case Attribute.AttributeType.ReadOnlyValueB:
                EditorGUI.LabelField(size, Value.GetString());
                return(Value);

            case Attribute.AttributeType.ReadOnlyValueA:
                EditorGUI.LabelField(size, Value.GetString());
                return(Value);

            case Attribute.AttributeType.RenameNodeTitle:
                EditorGUI.LabelField(size, Value.GetString());
                return(Value);

            default:
                return(Value);
            }
        }
 public AttributeData(Attribute.AttributeType _type)
 {
     Value = new Variable();
     Value.Set(0);
     Type = _type;
 }