Example #1
0
    public virtual void OnDirectionChange(OrientationEnum direction)
    {
        int referenceOffset = 0;

        if (direction == OrientationEnum.Down_By180)
        {
            referenceOffset = 0;
        }

        if (direction == OrientationEnum.Up_By0)
        {
            referenceOffset = 1;
        }

        if (direction == OrientationEnum.Right_By90)
        {
            referenceOffset = 2;
        }

        if (direction == OrientationEnum.Left_By270)
        {
            referenceOffset = 3;
        }

        if (spriteOrder != null)
        {
            if (spriteOrder.Orders.Count > referenceOffset)
            {
                spriteRenderer.sortingOrder = spriteOrder.Orders[referenceOffset];
            }
        }

        SpriteHandler.ChangeSpriteVariant(referenceOffset, false);
    }
Example #2
0
    public override void OnDirectionChange(OrientationEnum direction)
    {
        int referenceOffset = 0;

        if (direction == OrientationEnum.Down_By180)
        {
            referenceOffset = 0;
        }

        if (direction == OrientationEnum.Up_By0)
        {
            referenceOffset = 1;
        }

        if (direction == OrientationEnum.Right_By90)
        {
            referenceOffset = 2;
        }

        if (direction == OrientationEnum.Left_By270)
        {
            referenceOffset = 3;
        }

        baseSpriteHandler.ChangeSpriteVariant(referenceOffset);
        OverlySpriteHandler.ChangeSpriteVariant(referenceOffset);
    }
    void Update()
    {
        if (Input.GetKeyUp(KeyCode.KeypadEnter))
        {
            Orientation++;

            if (Orientation >= (OrientationEnum)4)
            {
                Orientation = 0;
            }

            SetOrientation(Orientation);
        }

        // TODO: this should be a part of the sorting system proper!
        currentY = Mathf.RoundToInt(transform.position.y - 0.5f);
        if (currentY != prevY)
        {
            prevY = currentY;

            newSortOrder = UVController.GetSortOrderFromGridY(GameGrid.GetInstance().GetNodeFromWorldPos(transform.position).GridPos.y);
            BodyRenderer.sortingOrder  = newSortOrder + 2;
            HeadRenderer.sortingOrder  = newSortOrder + 3;
            BeardRenderer.sortingOrder = newSortOrder + 4;
            EyeRenderer.sortingOrder   = newSortOrder + 5;
            HairRenderer.sortingOrder  = newSortOrder + 6;
        }
    }
Example #4
0
        private void setActiveDeviceGrant(Byte[] bas)
        {
            if (displayStrategyMVBD == null)
            {
                return;
            }
            OrientationEnum orientation = OrientationEnum.Unknown;

            if (Enum.IsDefined(typeof(OrientationEnum), (int)bas[2]))
            {
                orientation = (OrientationEnum)bas[2];
            }
            String deviceName = "";
            int    deviceId   = (bas[3] << 0 | bas[4] << 8 | bas[5] << 16 | bas[6] << 24);

            if (displayStrategyMVBD.deviceList != null)
            {
                foreach (Device device in displayStrategyMVBD.deviceList)
                {
                    if (device.id == deviceId)
                    {
                        deviceName = device.name;
                    }
                }
            }
            Device d = new Device(bas[1], bas[0], orientation, deviceName, typeof(DisplayStrategyMVBD));

            d.id = deviceId;
            displayStrategyMVBD.activeDevice = d;
        }
Example #5
0
 private void OnDirectionChange(OrientationEnum newDirection)
 {
     if (burningOverlay != null && burningOverlay.OverlayActive)
     {
         SetBurningOverlay();
     }
 }
Example #6
0
    private IEnumerator ClientRCSCoroutine(OrientationEnum releativeDirection, Orientation defaultFlyingDirection, bool isControlligPlayer = true, float flyTime = 1f)
    {
        // loop trough all thrusters
        foreach (var item in rcsThrusters)
        {
            // enable particle if thruster is pointing in movement direction
            // else disable
            bool active = item.Key == releativeDirection;
            foreach (var thruster in item.Value)
            {
                thruster.thrusterParticles.gameObject.SetActive(active);
            }
        }

        if (isControlligPlayer)
        {
            canClientUseRcs = false;
        }

        yield return(WaitFor.Seconds(flyTime));

        // set flyingDirection to movement direction after using RCS
        clientState.FlyingDirection = defaultFlyingDirection;
        clientState.IsMoving        = false;

        // disable all thrusters
        foreach (var thruster in rcsThrusters[releativeDirection])
        {
            thruster.thrusterParticles.gameObject.SetActive(false);
        }
    }
Example #7
0
 public Rover(string command, int initX = 0, int initY = 0, OrientationEnum initOrientation = OrientationEnum.N, bool errorFlag = false)
 {
     coordinates = new Point(initX, initY);
     Command     = command;
     currentDir  = initOrientation;
     ErrorFlag   = errorFlag;
 }
Example #8
0
 public Tree()
 {
     GrowthState = GrowthStateEnum.None;
     Orientation = OrientationEnum.Vertical;
     Level.Last = -1;
     Schema = Def.Schema;
 }
Example #9
0
        private OrientationEnum OrientateRight(OrientationEnum currentOrientation)
        {
            OrientationEnum newOrientation = currentOrientation;

            switch (currentOrientation)
            {
            case OrientationEnum.N:
                newOrientation = OrientationEnum.E;
                break;

            case OrientationEnum.E:
                newOrientation = OrientationEnum.S;
                break;

            case OrientationEnum.S:
                newOrientation = OrientationEnum.W;
                break;

            case OrientationEnum.W:
                newOrientation = OrientationEnum.N;
                break;
            }

            return(newOrientation);
        }
Example #10
0
    public Quaternion ByDegreesToQuaternion(OrientationEnum dir)
    {
        var outQuaternion = new Quaternion();

        switch (dir)
        {
        case OrientationEnum.Up_By0:
            outQuaternion.eulerAngles = new Vector3(0, 0, 0f);
            break;

        case OrientationEnum.Right_By270:
            outQuaternion.eulerAngles = new Vector3(0, 0, -90f);
            break;

        case OrientationEnum.Down_By180:
            outQuaternion.eulerAngles = new Vector3(0, 0, -180f);
            break;

        case OrientationEnum.Left_By90:
            outQuaternion.eulerAngles = new Vector3(0, 0, -270f);
            break;
        }

        return(outQuaternion);
    }
Example #11
0
        public OrientationEnum GetOrientation()
        {
            Random rndOrient     = new Random();
            int    orientationNr = rndOrient.Next(1, 5);

            switch (orientationNr)
            {
            case 1:
                Orientation = OrientationEnum.North;
                break;

            case 2:
                Orientation = OrientationEnum.South;
                break;

            case 3:
                Orientation = OrientationEnum.West;
                break;

            case 4:
                Orientation = OrientationEnum.East;
                break;
            }
            return(Orientation);
        }
Example #12
0
        public PlutoRover(ITerrain terrain, Point start, OrientationEnum orientation)
        {
            Start   = start;
            Terrain = terrain;

            CurrentLocation = new Location(start.X, start.Y, orientation);
        }
Example #13
0
        /// <summary>
        /// Marked public so that more simplified tests can be written
        /// </summary>
        /// <param name="orientation"></param>
        /// <returns></returns>
        public OrientationEnum ChangeOrientationLeft(OrientationEnum orientation)
        {
            OrientationEnum newOr;

            switch (orientation)
            {
            case OrientationEnum.North:
                newOr = OrientationEnum.West;
                break;

            case OrientationEnum.West:
                newOr = OrientationEnum.South;
                break;

            case OrientationEnum.South:
                newOr = OrientationEnum.East;
                break;

            case OrientationEnum.East:
                newOr = OrientationEnum.North;
                break;

            default:
                newOr = OrientationEnum.North;
                break;
            }
            return(newOr);
        }
Example #14
0
 public void OnValidate()
 {
     Awake();
     CurrentDirection = CurrentDirection;
     RotateObject(CurrentDirection);
     ResitOthers();
 }
Example #15
0
 public i000206 this[OrientationEnum p0]
 {
     get
     {
         return this.f00003e[(int) p0];
     }
 }
Example #16
0
    /// <summary>
    /// Поворот
    /// </summary>
    protected virtual void Turn()
    {
        Vector3 vect = transform.localScale;

        orientation          = (OrientationEnum)(-1 * (int)orientation);
        transform.localScale = new Vector3(-1 * vect.x, vect.y, vect.z);
    }
        /// <summary>
        /// Advances the disposal traversal by one tile.
        /// </summary>
        public void Traverse()
        {
            ReadyToTraverse = false;

            // Check if just started so we don't end the traversal at the disposal machine we started from.
            if (justStarted == false && currentPipe.PipeType == DisposalPipeType.Terminal)
            {
                EjectViaDisposalPipeTerminal();
                return;
            }

            // Advance to next pipe
            justStarted = false;
            OrientationEnum nextPipeRequiredSide = GetConnectedSide(currentPipeOutputSide).AsEnum();
            DisposalPipe    nextPipe             = GetPipeAt(NextPipeLocalPosition, requiredSide: nextPipeRequiredSide);

            if (nextPipe == null)
            {
                EjectViaPipeEnd();
                return;
            }

            TransferContainerToVector(NextPipeVector);
            currentPipeLocalPos   = NextPipeLocalPosition;
            currentPipeOutputSide = Orientation.FromEnum(GetPipeLeavingSide(nextPipe, nextPipeRequiredSide));
            currentPipe           = nextPipe;

            ReadyToTraverse = true;
        }
Example #18
0
 public c000274 this[OrientationEnum p0]
 {
     get
     {
         return this[(int) p0];
     }
 }
 protected override void Turn(OrientationEnum _orientation)
 {
     if (employment >= 8)
     {
         base.Turn(_orientation);
     }
 }
Example #20
0
 private void OnDirectionChanged(OrientationEnum arg0)
 {
     if (!CanPlayerStillProgress())
     {
         InterruptProgress("performer direction changed");
     }
 }
Example #21
0
        public void CleaningRobot_battery_reduced_by_turn_left_battery_cost(OrientationEnum orientation)
        {
            var sut             = CreateRobot(orientation: orientation);
            var expectedBattery = sut.Battery - Instruction.TurnLeft.BatteryCost;

            sut.ExecuteInstruction(Instruction.TurnLeft);
            sut.Battery.ShouldEqual(expectedBattery);
        }
Example #22
0
 public void CommandLeft()
 {
     --Orientation;
     if (!Enum.IsDefined(typeof(OrientationEnum), (int)Orientation))
     {
         Orientation = Enum.GetValues(typeof(OrientationEnum)).Cast <OrientationEnum>().Last();
     }
 }
Example #23
0
 // invoked when buckledTo changes direction, so we can update our direction
 private void OnBuckledObjectDirectionChange(OrientationEnum newDir)
 {
     if (playerDirectional == null)
     {
         playerDirectional = gameObject.GetComponent <Rotatable>();
     }
     playerDirectional.FaceDirection(newDir);
 }
Example #24
0
 public void CommandRight()
 {
     ++Orientation;
     if (!Enum.IsDefined(typeof(OrientationEnum), (int)Orientation))
     {
         Orientation = 0;
     }
 }
Example #25
0
        public LocationBlocked(string reason, int x, int y, OrientationEnum orientation)
        {
            X           = x;
            Y           = y;
            Orientation = orientation;

            Reason = reason;
        }
Example #26
0
 public void LockDirectionTo(bool Lock, OrientationEnum Dir)
 {
     SyncServerLockAndDirection(SynchroniseCurrentLockAndDirection,
                                new LockAndDirection()
     {
         Locked = Lock, LockedTo = Dir
     });
 }
Example #27
0
 public Robot(Coordinate coordinate, OrientationEnum orientation, Plateau plateau)
 {
     Coordinate           = coordinate;
     Orientation          = orientation;
     Plateau              = plateau;
     IsInsidePlateau      = true;
     PreviousCoordinates  = new List <Coordinate>();
     PreviousOrientations = new List <OrientationEnum>();
 }
Example #28
0
 /// <summary>
 /// Поворот
 /// </summary>
 protected virtual void Turn(OrientationEnum _orientation)
 {
     if (orientation != _orientation)
     {
         Vector3 vect = transform.localScale;
         orientation          = _orientation;
         transform.localScale = new Vector3(-1 * vect.x, vect.y, vect.z);
     }
 }
Example #29
0
 private void SyncServerDirection(OrientationEnum oldDir, OrientationEnum dir)
 {
     CurrentDirection            = dir;
     SynchroniseCurrentDirection = dir;
     RotateObject(dir);
     if (oldDir != dir)
     {
         OnRotationChange.Invoke(dir);
     }
 }
Example #30
0
        public Robot(int initialX, int initialY, OrientationEnum orientation, IGrid grid, IRobotCommandMarshaller commandMarshaller)
        {
            _commandMarshaller = commandMarshaller;
            _commandMarshaller.SetRobot(this);

            _grid = grid;
            X = initialX;
            Y = initialY;
            Orientation = orientation;
        }
Example #31
0
        //TODO: + Toche, hardware keys

        public Device(int height, int width, OrientationEnum orientation, String name, Type deviceClassType)
            : this()
        {
            this.height                   = height;
            this.width                    = width;
            this.orientation              = orientation;
            this.name                     = name;
            this.deviceClassTypeFullName  = deviceClassType.FullName;
            this.deviceClassTypeNamespace = deviceClassType.Namespace;
        }
Example #32
0
 public void Turn(Direction direction)
 {
     //Turning left is anticlockwise, right is clockwise
     if (Orientation == OrientationEnum.W && direction == Direction.Right)
         Orientation = OrientationEnum.N;
     else if (Orientation == OrientationEnum.N && direction == Direction.Left)
         Orientation = OrientationEnum.W;
     else
         Orientation += direction == Direction.Left ? -1 : 1;
 }
Example #33
0
    /// <summary>
    /// Перемещение
    /// </summary>
    protected override void Move(OrientationEnum _orientation)
    {
        Vector2 targetVelocity = new Vector2((int)_orientation * speed,rigid.velocity.y);
        rigid.velocity = Vector2.Lerp(rigid.velocity, targetVelocity, Time.fixedDeltaTime * acceleration);

        if (orientation != _orientation)
        {
            Turn(_orientation);
        }
    }
Example #34
0
 public Transition(Document context, StyleEnum style, double duration, OrientationEnum orientation, PageDirectionEnum pageDirection, DirectionEnum direction, double scale)
     : this(context)
 {
     Style         = style;
     Duration      = duration;
     Orientation   = orientation;
     PageDirection = pageDirection;
     Direction     = direction;
     Scale         = scale;
 }
Example #35
0
        public void RotateLeftMovementTest(int startX, int startY, OrientationEnum startOrientation, int expectedX, int expectedY, OrientationEnum expectedOrientation)
        {
            var movement = new RotateLeftMovement();

            var(x, y, orientation) = movement.Move(startX, startY, startOrientation);

            x.Should().Be(expectedX);
            y.Should().Be(expectedY);
            orientation.Should().Be(expectedOrientation);
        }
Example #36
0
        public void CommandLeft_ResultsInCorrectOrientation(OrientationEnum start, OrientationEnum expectedResult)
        {
            // arrange
            IRobot robot = new Robot(0, 0, start, fiveByFiveGrid);

            // act
            robot.CommandLeft();

            // assert
            Assert.That(robot.Orientation, Is.EqualTo(expectedResult),
                string.Format("left rotation from {0} to {1} failed", start, expectedResult));
            Console.WriteLine(string.Format("left rotation from {0} to {1} succeeded", start, expectedResult));
        }
Example #37
0
        public void ExecuteInstructions_RobotEndsUpWhereItShould(string instructions,
            int expectedX, int expectedY, OrientationEnum expectedOrientation)
        {
            // arrange
            IGrid grid = new Grid(10,10);
            IRobotCommandMarshaller commandMarshaller = new RobotCommandMarshaller();
            IRobot robot = new Robot(0,0,OrientationEnum.North, grid, commandMarshaller);

            // act
            robot.ExecuteInstructions(instructions);

            // assert
            Assert.That(robot.X, Is.EqualTo(expectedX));
            Assert.That(robot.Y, Is.EqualTo(expectedY));
            Assert.That(robot.Orientation, Is.EqualTo(expectedOrientation));
        }
Example #38
0
 /// <summary>
 /// Explores Martian terrain, might be salvaged by a potato farmer in the future.
 /// </summary>
 /// <param name="name">Name of the rover.</param>
 /// <param name="position">Starting position of the rover</param>
 /// <param name="orientation">Starting orientation of the rover</param>
 /// <param name="comModule">Communication module used by the rover.</param>
 /// <param name="terrain">Martian terrain the rover is stationed on</param>
 public Rover(string name, IPosition position, OrientationEnum orientation, IComModule comModule, ITerrain terrain)
 {
     ComModule = comModule;
     Terrain = terrain;
     ComModule.Rover = this;
     Name = name;
     Position = position;
     Orientation = orientation;
     if (Terrain.IsEmpty(Position.X, Position.Y))
     {
         Terrain.Grid[Position.X, Position.Y] = this;
     }
     else
     {
         //There is an obstacle at the coordinates rover was meant to be placed
         throw new ObstacleInTheWayException(Terrain.Grid[Position.X, Position.Y]);
     }
 }
Example #39
0
        protected override void OnSizeAllocated(Gdk.Rectangle allocation)
        {
            base.OnSizeAllocated(allocation);

            int iSpaceAvailable, jSpaceAvailable;

            // The orientation is horizontal when the widget is wider than it is tall
            // The direction of 'i' is the horizontal (left-to-right) when
            // widget orientation is horizontal,
            // and vertical (top-to-bottom) when widget orientation is vertical.
            // 'j' is in the other direction.
            if (Allocation.Width > Allocation.Height)
            {
                orientation = OrientationEnum.Horizontal;
                iSpaceAvailable = Allocation.Width;
                jSpaceAvailable = Allocation.Height;
            }
            else
            {
                orientation = OrientationEnum.Vertical;
                iSpaceAvailable = Allocation.Height;
                jSpaceAvailable = Allocation.Width;
            }

            iSpaceAvailable -= primarySecondaryAreaSize + swatchAreaMargin;
            jSpaceAvailable -= 2 * swatchAreaMargin;

            // Determine max number of rows that can be displayed in available area
            int maxPossibleIRows = Math.Max(1, iSpaceAvailable / swatchSize);
            int maxPossibleJRows = Math.Max(1, jSpaceAvailable / swatchSize);

            int iRowsWithDefaultNumOfJRows = (int)Math.Ceiling((double)palette.Count / defaultNumOfJRows);

            // Display palette in default configuration if space is available
            // (it looks better)
            if ((maxPossibleJRows >= defaultNumOfJRows) && (maxPossibleIRows >= iRowsWithDefaultNumOfJRows))
            {
                iRows = iRowsWithDefaultNumOfJRows;
                jRows = defaultNumOfJRows;
            }
            else // Compress palette to fit within available space
            {
                iRows = (int)Math.Ceiling((double)palette.Count / maxPossibleJRows);
                jRows = (int)Math.Ceiling((double)palette.Count / iRows);
            }
        }
Example #40
0
 public CommandTestCaseData(OrientationEnum startOrientation, Action<IRobot> command, OrientationEnum expectedResult)
 {
     StartOrientation = startOrientation;
     Command = command;
     ExpectedOrientation = expectedResult;
 }
Example #41
0
        /**
          <summary>Gets the page size of the given format and orientation.</summary>
          <param name="size">Page size.</param>
          <param name="orientation">Page orientation.</param>
        */
        public static Size GetSize(
            SizeEnum size,
            OrientationEnum orientation
            )
        {
            int width, height = 0;

              // Size.
              {
            string sizeName = size.ToString();
            Match match = IsoSeriesSizePattern.Match(sizeName);
            // Is it an ISO standard size?
            if(match.Success)
            {
              int baseWidth, baseHeight = 0;
              string isoSeriesSize = match.Groups[1].Value;
              if(isoSeriesSize.Equals(IsoSeriesSize_A))
              {baseWidth = 2384; baseHeight = 3370;}
              else if(isoSeriesSize.Equals(IsoSeriesSize_B))
              {baseWidth = 2834; baseHeight = 4008;}
              else if(isoSeriesSize.Equals(IsoSeriesSize_C))
              {baseWidth = 2599; baseHeight = 3676;}
              else
              {throw new NotImplementedException("Paper format " + size + " not supported yet.");}

              int isoSeriesSizeIndex = Int32.Parse(match.Groups[2].Value);
              double isoSeriesSizeFactor = 1 / Math.Pow(2,isoSeriesSizeIndex/2d);

              width = (int)Math.Floor(baseWidth * isoSeriesSizeFactor);
              height = (int)Math.Floor(baseHeight * isoSeriesSizeFactor);
            }
            else // Non-ISO size.
            {
              switch(size)
              {
            case SizeEnum.ArchA: width = 648; height = 864; break;
            case SizeEnum.ArchB: width = 864; height = 1296; break;
            case SizeEnum.ArchC: width = 1296; height = 1728; break;
            case SizeEnum.ArchD: width = 1728; height = 2592; break;
            case SizeEnum.ArchE: width = 2592; height = 3456; break;
            case SizeEnum.AnsiA: case SizeEnum.Letter: width = 612; height = 792; break;
            case SizeEnum.AnsiB: case SizeEnum.Tabloid: width = 792; height = 1224; break;
            case SizeEnum.AnsiC: width = 1224; height = 1584; break;
            case SizeEnum.AnsiD: width = 1584; height = 2448; break;
            case SizeEnum.AnsiE: width = 2448; height = 3168; break;
            case SizeEnum.Legal: width = 612; height = 1008; break;
            case SizeEnum.Executive: width = 522; height = 756; break;
            case SizeEnum.Statement: width = 396; height = 612; break;
            default: throw new NotImplementedException("Paper format " + size + " not supported yet.");
              }
            }
              }

              // Orientation.
              switch(orientation)
              {
            case OrientationEnum.Portrait:
              return new Size(width,height);
            case OrientationEnum.Landscape:
              return new Size(height,width);
            default:
              throw new NotImplementedException("Orientation " + orientation + " not supported yet.");
              }
        }
Example #42
0
 public Robot(int initialX, int initialY, OrientationEnum orientation, IGrid grid)
     : this(initialX, initialY, orientation, grid, new RobotCommandMarshaller())
 {
 }
Example #43
0
 public c000274(OrientationEnum p0)
 {
     this.f000001 = p0;
     this.f0002c7 = new int[2];
     this.f0002ca = new Queue<c000275>();
 }
Example #44
0
 public c00026c(OrientationEnum p0)
     : base(p0)
 {
 }
Example #45
0
 public BaseController(OrientationEnum p0)
 {
     this.f000001 = p0;
     this.f00008e = new struct0207(ref this.f000056, ref this.f000276);
 }
Example #46
0
 public c000262(OrientationEnum p0)
     : base(p0)
 {
     base.m000313(0x2710);
 }
Example #47
0
 //
 //
 static Tree()
 {
     ArrayList bL = new ArrayList();
     LevelBrotherL.Add(bL);
     Orientation=OrientationEnum.Vertical;
 }
Example #48
0
        public void Ctor_CanInitialiseFromString(string setupString, int expectedX, int expectedY, OrientationEnum expectedOrientation)
        {
            // act
            IRobot robot = new Robot(setupString, fiveByFiveGrid);

            //Assert
            Assert.That(robot.X, Is.EqualTo(expectedX));
            Assert.That(robot.Y, Is.EqualTo(expectedY));
            Assert.That(robot.Orientation, Is.EqualTo(expectedOrientation));
        }
Example #49
0
 public c000267(OrientationEnum p0)
 {
     this.f00008e = GameDataInfo.Instance()[p0];
     this.f00027a = (BaseController) IPlayController.Instance()[p0];
 }
Example #50
0
 internal Orientation(OrientationEnum orientation)
 {
     _orientation = orientation;
 }