Esempio n. 1
0
        public void ChangeData(Coords from, Coords to, ChangeMethod changeMethod)
        {
            for (ushort x = from.X; x <= to.X; x++)
            {
                for (ushort y = from.Y; y <= to.Y; y++)
                {
                    var bufferIndex = y * _width + x;
                    switch (changeMethod)
                    {
                    case ChangeMethod.TurnOn:
                        _buffer[bufferIndex]++;
                        break;

                    case ChangeMethod.TurnOff:
                        if (_buffer[bufferIndex] > 0)
                        {
                            _buffer[bufferIndex]--;
                        }
                        break;

                    case ChangeMethod.Toggle:
                        _buffer[bufferIndex] += 2;
                        break;

                    default:
                        throw new ArgumentOutOfRangeException(nameof(changeMethod), changeMethod, null);
                    }
                }
            }
        }
Esempio n. 2
0
        private static void ChangeData(BitGrid bitGrid, Coords from, Coords to, ChangeMethod changeMethod)
        {
            for (ushort x = from.X; x <= to.X; x++)
            {
                for (ushort y = from.Y; y <= to.Y; y++)
                {
                    switch (changeMethod)
                    {
                    case ChangeMethod.TurnOn:
                        bitGrid[x, y] = true;
                        break;

                    case ChangeMethod.TurnOff:
                        bitGrid[x, y] = false;
                        break;

                    case ChangeMethod.Toggle:
                        bitGrid[x, y] = !bitGrid[x, y];
                        break;

                    default:
                        throw new ArgumentOutOfRangeException(nameof(changeMethod), changeMethod, null);
                    }
                }
            }
        }
 public void Change(float startV, float endV, float time, ChangeMethod changeMethod)
 {
     EndV         = endV;
     StartV       = startV;
     DeltaTime    = time;
     StartTime    = Time.time;
     ChangeMethod = changeMethod;
 }
 public void Change(float startV, float endV, float time, ChangeMethod changeMethod)
 {
     Debug.Log(string.Format("Adding changer from {0} to {1} ", startV, endV));
     EndV         = endV;
     StartV       = startV;
     DeltaTime    = time;
     StartTime    = Time.time;
     ChangeMethod = changeMethod;
 }
Esempio n. 5
0
 public ChangeCommand(ChangeMethod changeMethod, Coords coordsFrom, Coords coordsTo)
 {
     ChangeMethod = changeMethod;
     CoordsFrom   = coordsFrom;
     CoordsTo     = coordsTo;
 }