/// <summary> /// Applies a change to the given symbol in this world state. /// If not present, it will add it. /// </summary> /// <param name="name"></param> /// <param name="value"></param> public void Apply <T>(string key, T value) { var existingSymbol = Find(key); if (existingSymbol != null) { existingSymbol.value.Set(value); } else { symbols.Add(StratusSymbol.Construct(key, value)); } }
/// <summary> /// Applies a symbol to this world state. /// </summary> /// <param name="symbol"></param> public void Apply(StratusSymbol symbol) { var existingSymbol = Find(symbol.key); if (existingSymbol != null) { existingSymbol.value = symbol.value; } else { // Make a copy of that other symbol symbols.Add(new StratusSymbol(symbol)); } }
/// <summary> /// Checks whether this WorldState contains the given symbol with the same value /// </summary> /// <param name="symbol"></param> /// <returns></returns> public bool Contains(StratusSymbol symbol) { var existingSymbol = Find(symbol.key); // Look for a matching symbol if (existingSymbol != null) { if (existingSymbol.value.Compare(symbol.value)) { return(true); } } return(false); }
public ModifySymbolEvent(StratusSymbol symbol) { Symbol = symbol; }
private void OnGlobalSymbolChanged(StratusSymbol symbol) { StratusDebug.Log($"The value on global symbol {symbol} was changed to {symbol.value}", this); }
//--------------------------------------------------------------------/ // Callbacks //--------------------------------------------------------------------/ private void OnLocalSymbolChanged(GameObject gameObject, StratusSymbol symbol) { StratusDebug.Log($"The value on local symbol {symbol.key} on the GameObject {gameObject} was changed to {symbol.value}", this); }