public Signal(IMutableVariable <bool> clientRequestsBuffer, IMutableVariable <bool> clientReleasesBuffer, IVariable <sbyte> indexControlledByClient, params IVariable <TValue[]>[] bufferVariables) { _clientRequestsBuffer = clientRequestsBuffer; _clientReleasesBuffer = clientReleasesBuffer; _indexControlledByClient = indexControlledByClient; _bufferVariables = bufferVariables; }
private void Health_Changed(IMutableVariable <double> e) { if (e?.Value <= 0) { Death?.Invoke(this, this); } }
public WrappedMutableVariable(IMutableVariable <TMarshalledValue> variable, Func <TMarshalledValue, TValue> read, Func <TValue, TMarshalledValue> write) : base(variable, read) { if (write == null) { throw new ArgumentNullException(); } _variable = variable; _write = write; }
/// <summary> /// Process a change in dweller movement /// </summary> /// <param name="dweller"></param> /// <param name="newLocation"></param> private void ProcessDwellerMovement(IDweller dweller, IMutableVariable <Point> newLocation) { // are we already in something? If so, then exit it if our new location is different to the thing if (newLocation.Value != dweller.InsideBuilding?.Position?.Value) { // exit the object we're inside dweller.ExitBuilding(); } // are we now entering an object? //foreach (var home in Homes) CheckNewLocation(dweller, home); //foreach (var workplace in Workplaces) CheckNewLocation(dweller, workplace); //foreach (var cafe in Cafes) CheckNewLocation(dweller, cafe); }
public static IMutableVariable <TValue> Wrap <TValue, TMarshalledValue>(this IMutableVariable <TMarshalledValue> handle, Func <TMarshalledValue, TValue> read, Func <TValue, TMarshalledValue> write) { return(new WrappedMutableVariable <TValue, TMarshalledValue>(handle, read, write)); }