/// <summary> /// Used for adding a new variable to this list. /// </summary> public void AddVariable(PoolVariable newVariable) { // Adds a new variable to the pool chance. if (newVariable.variable != null) { poolVariables.Add(newVariable); } else { Debug.Log(newVariable.name + " has no variable assigned!"); } }
/// <summary> /// Checks if an action has already been added to the list. /// </summary> public bool Contains(PoolVariable checkVariable) { // Checks each variable in the list until it finds the Remove Variable. GameObject checkedObject = checkVariable.variable; foreach (PoolVariable variable in poolVariables) { if (variable.variable == checkedObject) { return(true); } } // Action is not in the list, let's go back. return(false); }