public int CompareTo(object obj)
        {
            NamedVariable namedVariable = obj as NamedVariable;

            if (namedVariable == null)
            {
                return(0);
            }
            return(string.CompareOrdinal(this.name, namedVariable.name));
        }
 public NamedVariable(NamedVariable source)
 {
     if (source != null)
     {
         this.useVariable     = source.useVariable;
         this.name            = source.name;
         this.showInInspector = source.showInInspector;
         this.tooltip         = source.tooltip;
         this.networkSync     = source.networkSync;
     }
 }
Esempio n. 3
0
 public void Init(NamedVariable variable)
 {
     if (variable != null)
     {
         this.type         = variable.VariableType;
         this.variableName = variable.Name;
     }
     else
     {
         this.variableName = "";
     }
     this.NamedVar = variable;
 }
Esempio n. 4
0
 public void Init(NamedVariable variable)
 {
     if (variable != null)
     {
         type         = variable.VariableType;
         variableName = variable.Name;
     }
     else
     {
         variableName = "";
     }
     NamedVar = variable;
 }
        public static bool CanEditTargetPosition(PositionOptions option, NamedVariable position, FsmGameObject target)
        {
            switch (option)
            {
            case PositionOptions.CurrentPosition:
                return(false);

            case PositionOptions.WorldPosition:
            case PositionOptions.LocalPosition:
            case PositionOptions.WorldOffset:
            case PositionOptions.LocalOffset:
                return(!position.IsNone);

            case PositionOptions.TargetGameObject:
                return(target.Value != null);

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
        private static bool CanEditTargetRotation(RotationOptions option, NamedVariable rotation, FsmGameObject target)
        {
            switch (option)
            {
            case RotationOptions.CurrentRotation:
                return(false);

            case RotationOptions.WorldRotation:
            case RotationOptions.LocalRotation:
            case RotationOptions.WorldOffsetRotation:
            case RotationOptions.LocalOffsetRotation:
                return(!rotation.IsNone);

            case RotationOptions.MatchGameObjectRotation:
                return(target.Value != null);

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Esempio n. 7
0
 public void UpdateOverrides()
 {
     if (this.fsmTemplate != null)
     {
         List <SkillVarOverride> list              = new List <SkillVarOverride>(this.fsmVarOverrides);
         List <SkillVarOverride> list2             = new List <SkillVarOverride>();
         NamedVariable[]         allNamedVariables = this.fsmTemplate.fsm.Variables.GetAllNamedVariables();
         for (int i = 0; i < allNamedVariables.Length; i++)
         {
             NamedVariable namedVariable = allNamedVariables[i];
             if (namedVariable.ShowInInspector)
             {
                 SkillVarOverride fsmVarOverride = list.Find((SkillVarOverride o) => o.variable.Name == namedVariable.Name);
                 list2.Add(fsmVarOverride ?? new SkillVarOverride(namedVariable));
             }
         }
         this.fsmVarOverrides = list2.ToArray();
         return;
     }
     this.fsmVarOverrides = new SkillVarOverride[0];
 }
Esempio n. 8
0
 /// <summary>
 /// ActionName: property -> store
 /// </summary>
 public static string AutoNameGetProperty(FsmStateAction action, NamedVariable property, NamedVariable store)
 {
     return(action == null ? null : AutoNameGetProperty(action.GetType().Name, property, store));
 }
Esempio n. 9
0
 /// <summary>
 /// [-Convert]ActionName: fromVar to toVar
 /// </summary>
 public static string AutoNameConvert(FsmStateAction action, NamedVariable fromVariable, NamedVariable toVariable)
 {
     return(action == null ? null : AutoNameConvert(action.GetType().Name, fromVariable, toVariable));
 }
Esempio n. 10
0
 /// <summary>
 /// [-Convert]ActionName: fromVar to toVar
 /// </summary>
 public static string AutoNameConvert(string actionName, NamedVariable fromVariable, NamedVariable toVariable)
 {
     return(actionName.Replace("Convert", "") + colon + GetValueLabel(fromVariable) + " to " + GetValueLabel(toVariable));
 }
Esempio n. 11
0
 /// <summary>
 /// ActionName: var = value
 /// </summary>
 public static string AutoNameSetVar(FsmStateAction action, NamedVariable var, NamedVariable value)
 {
     return(action == null ? null : AutoNameSetVar(action.GetType().Name, var, value));
 }
Esempio n. 12
0
 /// <summary>
 /// ActionName: var = value
 /// </summary>
 public static string AutoNameSetVar(string actionName, NamedVariable var, NamedVariable value)
 {
     return(actionName + colon + GetValueLabel(var) + " = " + GetValueLabel(value));
 }
Esempio n. 13
0
 /// <summary>
 /// ActionName: min - max
 /// </summary>
 public static string AutoNameRange(FsmStateAction action, NamedVariable min, NamedVariable max)
 {
     return(action == null ? null : AutoNameRange(action.GetType().Name, min, max));
 }
Esempio n. 14
0
 /// <summary>
 /// ActionName: min - max
 /// </summary>
 public static string AutoNameRange(string actionName, NamedVariable min, NamedVariable max)
 {
     return(actionName + colon + GetValueLabel(min) + " - " + GetValueLabel(max));
 }
Esempio n. 15
0
        private void InitNamedVar()
        {
            switch (this.type)
            {
            case VariableType.Unknown:
                this.namedVar     = null;
                this.namedVarType = null;
                return;

            case VariableType.Float:
                this.namedVar = new SkillFloat(this.variableName)
                {
                    Value = this.floatValue
                };
                break;

            case VariableType.Int:
                this.namedVar = new SkillInt(this.variableName)
                {
                    Value = this.intValue
                };
                break;

            case VariableType.Bool:
                this.namedVar = new SkillBool(this.variableName)
                {
                    Value = this.boolValue
                };
                break;

            case VariableType.GameObject:
                this.namedVar = new SkillGameObject(this.variableName)
                {
                    Value = this.gameObjectValue
                };
                break;

            case VariableType.String:
                this.namedVar = new SkillString(this.variableName)
                {
                    Value = this.stringValue
                };
                break;

            case VariableType.Vector2:
                this.namedVar = new SkillVector2(this.variableName)
                {
                    Value = this.vector2Value
                };
                break;

            case VariableType.Vector3:
                this.namedVar = new SkillVector3(this.variableName)
                {
                    Value = this.vector3Value
                };
                break;

            case VariableType.Color:
                this.namedVar = new SkillColor(this.variableName)
                {
                    Value = this.colorValue
                };
                break;

            case VariableType.Rect:
                this.namedVar = new SkillRect(this.variableName)
                {
                    Value = this.rectValue
                };
                break;

            case VariableType.Material:
                this.namedVar = new SkillMaterial(this.variableName)
                {
                    Value = this.materialValue
                };
                break;

            case VariableType.Texture:
                this.namedVar = new SkillTexture(this.variableName)
                {
                    Value = this.textureValue
                };
                break;

            case VariableType.Quaternion:
                this.namedVar = new SkillQuaternion(this.variableName)
                {
                    Value = this.quaternionValue
                };
                break;

            case VariableType.Object:
                this.namedVar = new SkillObject(this.variableName)
                {
                    ObjectType = this.ObjectType,
                    Value      = this.objectReference
                };
                break;

            case VariableType.Array:
            {
                SkillArray fsmArray = new SkillArray(this.variableName)
                {
                    ElementType = this.arrayValue.ElementType,
                    ObjectType  = this.arrayValue.ObjectType
                };
                fsmArray.CopyValues(this.arrayValue);
                fsmArray.SaveChanges();
                this.namedVar = fsmArray;
                break;
            }

            case VariableType.Enum:
                this.namedVar = new SkillEnum(this.variableName)
                {
                    EnumType = this.EnumType,
                    Value    = this.EnumValue
                };
                break;

            default:
                throw new ArgumentOutOfRangeException("Type");
            }
            if (this.namedVar != null)
            {
                this.namedVarType         = this.namedVar.GetType();
                this.namedVar.UseVariable = this.useVariable;
            }
        }
Esempio n. 16
0
        public void SetVariable(NamedVariable variable)
        {
            if (variable == null)
            {
                ResetParameters();
                return;
            }
            switch (variable.VariableType)
            {
            case VariableType.Float:
                FloatParameter = variable as FsmFloat;
                break;

            case VariableType.Int:
                IntParameter = variable as FsmInt;
                break;

            case VariableType.Bool:
                BoolParameter = variable as FsmBool;
                break;

            case VariableType.GameObject:
                GameObjectParameter = variable as FsmGameObject;
                break;

            case VariableType.String:
                StringParameter = variable as FsmString;
                break;

            case VariableType.Vector2:
                Vector2Parameter = variable as FsmVector2;
                break;

            case VariableType.Vector3:
                Vector3Parameter = variable as FsmVector3;
                break;

            case VariableType.Color:
                ColorParameter = variable as FsmColor;
                break;

            case VariableType.Rect:
                RectParamater = variable as FsmRect;
                break;

            case VariableType.Material:
                MaterialParameter = variable as FsmMaterial;
                break;

            case VariableType.Texture:
                TextureParameter = variable as FsmTexture;
                break;

            case VariableType.Quaternion:
                QuaternionParameter = variable as FsmQuaternion;
                break;

            case VariableType.Object:
                ObjectParameter = variable as FsmObject;
                break;

            case VariableType.Array:
                ArrayParameter = variable as FsmArray;
                break;

            case VariableType.Enum:
                EnumParameter = variable as FsmEnum;
                break;

            default:
                throw new ArgumentOutOfRangeException();

            case VariableType.Unknown:
                break;
            }
        }
Esempio n. 17
0
 public void Apply(SkillVariables variables)
 {
     this.variable = variables.GetVariable(this.variable.Name);
     this.fsmVar.ApplyValueTo(this.variable);
 }
Esempio n. 18
0
 public FsmVarOverride(FsmVarOverride source)
 {
     variable = new NamedVariable(source.variable.Name);
     fsmVar   = new FsmVar(source.fsmVar);
     isEdited = source.isEdited;
 }
Esempio n. 19
0
 /// <summary>
 /// ActionName: property -> store
 /// </summary>
 public static string AutoNameGetProperty(string actionName, NamedVariable property, NamedVariable store)
 {
     return(actionName + colon + GetValueLabel(property) + " -> " + GetValueLabel(store));
 }
Esempio n. 20
0
 public FsmVarOverride(NamedVariable namedVar)
 {
     variable = namedVar;
     fsmVar   = new FsmVar(variable);
     isEdited = false;
 }
Esempio n. 21
0
 public void Apply(FsmVariables variables)
 {
     variable = variables.GetVariable(variable.Name);
     fsmVar.ApplyValueTo(variable);
 }
Esempio n. 22
0
 public static bool IsNullOrNone(NamedVariable variable)
 {
     return(variable == null || variable.IsNone);
 }
Esempio n. 23
0
        private void InitNamedVar()
        {
            switch (type)
            {
            case VariableType.Float:
                namedVar = new FsmFloat(variableName)
                {
                    Value = floatValue
                };
                break;

            case VariableType.Int:
                namedVar = new FsmInt(variableName)
                {
                    Value = intValue
                };
                break;

            case VariableType.Bool:
                namedVar = new FsmBool(variableName)
                {
                    Value = boolValue
                };
                break;

            case VariableType.GameObject:
                namedVar = new FsmGameObject(variableName)
                {
                    Value = gameObjectValue
                };
                break;

            case VariableType.String:
                namedVar = new FsmString(variableName)
                {
                    Value = stringValue
                };
                break;

            case VariableType.Vector2:
                namedVar = new FsmVector2(variableName)
                {
                    Value = vector2Value
                };
                break;

            case VariableType.Vector3:
                namedVar = new FsmVector3(variableName)
                {
                    Value = vector3Value
                };
                break;

            case VariableType.Color:
                namedVar = new FsmColor(variableName)
                {
                    Value = colorValue
                };
                break;

            case VariableType.Rect:
                namedVar = new FsmRect(variableName)
                {
                    Value = rectValue
                };
                break;

            case VariableType.Material:
                namedVar = new FsmMaterial(variableName)
                {
                    Value = materialValue
                };
                break;

            case VariableType.Texture:
                namedVar = new FsmTexture(variableName)
                {
                    Value = textureValue
                };
                break;

            case VariableType.Quaternion:
                namedVar = new FsmQuaternion(variableName)
                {
                    Value = quaternionValue
                };
                break;

            case VariableType.Object:
                namedVar = new FsmObject(variableName)
                {
                    ObjectType = ObjectType,
                    Value      = objectReference
                };
                break;

            case VariableType.Enum:
                namedVar = new FsmEnum(variableName)
                {
                    EnumType = EnumType,
                    Value    = EnumValue
                };
                break;

            case VariableType.Array:
            {
                FsmArray fsmArray = new FsmArray(variableName);
                fsmArray.ElementType = arrayValue.ElementType;
                fsmArray.ObjectType  = arrayValue.ObjectType;
                FsmArray fsmArray2 = fsmArray;
                fsmArray2.CopyValues(arrayValue);
                fsmArray2.SaveChanges();
                namedVar = fsmArray2;
                break;
            }

            case VariableType.Unknown:
                namedVar     = null;
                namedVarType = null;
                return;

            default:
                throw new ArgumentOutOfRangeException("Type");
            }
            if (namedVar != null)
            {
                namedVarType         = namedVar.GetType();
                namedVar.UseVariable = useVariable;
            }
        }
Esempio n. 24
0
 public SkillVarOverride(NamedVariable namedVar)
 {
     this.variable = namedVar;
     this.fsmVar   = new SkillVar(this.variable);
     this.isEdited = false;
 }
Esempio n. 25
0
        public void SetVariable(NamedVariable variable)
        {
            if (variable == null)
            {
                this.ResetParameters();
                return;
            }
            switch (variable.VariableType)
            {
            case VariableType.Unknown:
                return;

            case VariableType.Float:
                this.FloatParameter = (variable as SkillFloat);
                return;

            case VariableType.Int:
                this.IntParameter = (variable as SkillInt);
                return;

            case VariableType.Bool:
                this.BoolParameter = (variable as SkillBool);
                return;

            case VariableType.GameObject:
                this.GameObjectParameter = (variable as SkillGameObject);
                return;

            case VariableType.String:
                this.StringParameter = (variable as SkillString);
                return;

            case VariableType.Vector2:
                this.Vector2Parameter = (variable as SkillVector2);
                return;

            case VariableType.Vector3:
                this.Vector3Parameter = (variable as SkillVector3);
                return;

            case VariableType.Color:
                this.ColorParameter = (variable as SkillColor);
                return;

            case VariableType.Rect:
                this.RectParamater = (variable as SkillRect);
                return;

            case VariableType.Material:
                this.MaterialParameter = (variable as SkillMaterial);
                return;

            case VariableType.Texture:
                this.TextureParameter = (variable as SkillTexture);
                return;

            case VariableType.Quaternion:
                this.QuaternionParameter = (variable as SkillQuaternion);
                return;

            case VariableType.Object:
                this.ObjectParameter = (variable as SkillObject);
                return;

            case VariableType.Array:
                this.ArrayParameter = (variable as SkillArray);
                return;

            case VariableType.Enum:
                this.EnumParameter = (variable as SkillEnum);
                return;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Esempio n. 26
0
 public SkillVarOverride(SkillVarOverride source)
 {
     this.variable = new NamedVariable(source.variable.Name);
     this.fsmVar   = new SkillVar(source.fsmVar);
     this.isEdited = source.isEdited;
 }
Esempio n. 27
0
 public static bool IsNullOrNone(NamedVariable variable)
 {
     return(variable?.IsNone ?? true);
 }