Exemplo n.º 1
0
 public Signal(IMutableVariable <bool> clientRequestsBuffer, IMutableVariable <bool> clientReleasesBuffer, IVariable <sbyte> indexControlledByClient, params IVariable <TValue[]>[] bufferVariables)
 {
     _clientRequestsBuffer    = clientRequestsBuffer;
     _clientReleasesBuffer    = clientReleasesBuffer;
     _indexControlledByClient = indexControlledByClient;
     _bufferVariables         = bufferVariables;
 }
Exemplo n.º 2
0
 private void Health_Changed(IMutableVariable <double> e)
 {
     if (e?.Value <= 0)
     {
         Death?.Invoke(this, this);
     }
 }
Exemplo n.º 3
0
        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;
        }
Exemplo n.º 4
0
        /// <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);
        }
Exemplo n.º 5
0
 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));
 }