/** * <summary>Sets its value to that of its linked variable (if appropriate).</summary> * <param name = "_location">The variable's location</param> * <param name = "_variables">The variable's Variables component, if location = VariableLocation.Component</param> */ public void Download(VariableLocation _location = VariableLocation.Global, Variables _variables = null) { if (_location == VariableLocation.Local) { return; } if (link == VarLink.PlaymakerVariable && !string.IsNullOrEmpty(pmVar)) { if (!PlayMakerIntegration.IsDefinePresent()) { return; } if (_location != VariableLocation.Component) { _variables = null; } if (_location == VariableLocation.Component && _variables == null) { return; } switch (type) { case VariableType.Integer: case VariableType.PopUp: SetValue(PlayMakerIntegration.GetInt(pmVar, _variables)); break; case VariableType.Boolean: bool _val = PlayMakerIntegration.GetBool(pmVar, _variables); SetValue((_val) ? 1 : 0); break; case VariableType.String: SetStringValue(PlayMakerIntegration.GetString(pmVar, _variables)); break; case VariableType.Float: SetFloatValue(PlayMakerIntegration.GetFloat(pmVar, _variables)); break; case VariableType.Vector3: SetVector3Value(PlayMakerIntegration.GetVector3(pmVar, _variables)); break; } } else if (link == VarLink.CustomScript) { KickStarter.eventManager.Call_OnDownloadVariable(this); } }