/// <summary>
        /// This method will update all the variables bind to the Alias string with the current newValue
        /// </summary>
        /// <param name="newValue"></param>
        /// <param name="Alias"></param>
        private void UpdateVariables(egVar newValue, string Alias)
        {
            // errorVariableList will collect all the wrong binds and delete them
            List <egVar> errorVariableList = new List <egVar>();

            // foreach element in the dicitonary with the Alias key we will update the variables
            if (varDictionary.ContainsKey(Alias))
            {
                List <egVar> egList = varDictionary[Alias];
                foreach (egVar var in egList)
                {
                    // if the type is correct we will update the variable
                    // there is another control on the type inside the UpdateVal method in the egVar sons
                    if (true)                    //newValue.GetType() == var.GetType())
                    {
                        var.UpdateVal(newValue);
                    }
                    else
                    {
                        //if the type is not correct we will add the variables to the errorVariableList and send a message to the console
                        Debug.Log("Attempting to update a " + var.GetType() + " with a " + newValue.GetType() + " variable. Check the variable type. This registration will be deleted.");
                        errorVariableList.Add(var);
                    }
                }
            }
            // at the end of the routine we will delete all the variables on the errorVariableList will be unbinded
            FixErrorList(errorVariableList, Alias);
        }
Esempio n. 2
0
 public override void UpdateVal(egVar var)
 {
     if (var.GetType() == typeof(egBool))
     {
         updated = true;
         egBool b = (egBool)var;
         _Value = b;
     }
     else
     {
         Console.WriteLine("Type: " + var.GetType() + " not supported by egBool");
     }
 }
Esempio n. 3
0
 public override void UpdateVal(egVar var)
 {
     if (var.GetType() == typeof(egFloat))
     {
         updated = true;
         egFloat s = (egFloat)var;
         _Value = s;
     }
     else
     {
         Console.WriteLine("Type: " + var.GetType() + " not supported by egString");
     }
 }
        /// <summary>
        /// Register a variable to the variableHandler and keep it updated as the parameters changes
        /// </summary>
        /// <param name="Key">the key represent the aslias of the parameters. Use the static class egParameterStrings to have access to the avaiable keys</param>
        /// <param name="var"></param>
        public void Register(string Key, egVar var)
        {
            List <egVar> list;

            if (!varDictionary.TryGetValue(Key, out list))
            {
                list = new List <egVar>();
                varDictionary.Add(Key, list);
            }
            list.Add(var);
            if (ParameterHandler.Instance != null && ParameterHandler.Instance.AllParameters != null)
            {
                UpdateRoutine(ParameterHandler.Instance.AllParameters[0].GetParameter(Key));
            }
        }
Esempio n. 5
0
 public abstract void UpdateVal(egVar var);