コード例 #1
0
 private void Register(IRotatable obj, ICollection <IRotatable> list)
 {
     if (obj != null && !list.Contains(obj))
     {
         list.Add(obj);
     }
 }
コード例 #2
0
        public RotationInterpolator(IRotatable target, float start, float end, EaseTypes easeType,
                                    float duration = 0, bool isRepeatable = true) : base(start, end, duration, easeType, isRepeatable)
        {
            Debug.Assert(target != null, NullMessage);

            this.target = target;
        }
コード例 #3
0
        private static void RotateLeftLayer <T>(DataCube <T> cube, int left)
        {
            int max = cube.Size - 1;

            for (int i = 0; i < cube.Size / 2; i++)
            {
                for (int j = i; j < max - i; j++)
                {
                    T temp = cube[left, i, j];

                    cube[left, i, j]             = cube[left, max - j, i];
                    cube[left, max - j, i]       = cube[left, max - i, max - j];
                    cube[left, max - i, max - j] = cube[left, j, max - i];
                    cube[left, j, max - i]       = temp;
                }
            }

            for (int i = 0; i < cube.Size; i++)
            {
                for (int j = 0; j < cube.Size; j++)
                {
                    IRotatable rotatable = cube[left, i, j] as IRotatable;
                    if (rotatable != null)
                    {
                        rotatable.RotateAroundLeft();
                    }
                }
            }
        }
コード例 #4
0
        public void OrientationTest()
        {
            IRotatable rotatable = ((IRotatable)driver);

            rotatable.Orientation = ScreenOrientation.Landscape;
            Assert.AreEqual(ScreenOrientation.Landscape, rotatable.Orientation);
        }
コード例 #5
0
        private static void RotateTopLayer <T>(DataCube <T> cube, int top)
        {
            if (top < 0 || top > cube.Size)
            {
                throw new ArgumentOutOfRangeException("top");
            }

            int max = cube.Size - 1;

            for (int i = 0; i < cube.Size / 2; i++)
            {
                for (int j = i; j < max - i; j++)
                {
                    T temp = cube[j, top, i];

                    cube[j, top, i]             = cube[i, top, max - j];
                    cube[i, top, max - j]       = cube[max - j, top, max - i];
                    cube[max - j, top, max - i] = cube[max - i, top, j];
                    cube[max - i, top, j]       = temp;
                }
            }

            for (int i = 0; i < cube.Size; i++)
            {
                for (int j = 0; j < cube.Size; j++)
                {
                    IRotatable rotatable = cube[i, top, j] as IRotatable;
                    if (rotatable != null)
                    {
                        rotatable.RotateAroundTop();
                    }
                }
            }
        }
コード例 #6
0
        public void OrientationTest()
        {
            IRotatable rotatable = ((IRotatable)driver);

            rotatable.Orientation = ScreenOrientation.Portrait;
            Assert.AreEqual(ScreenOrientation.Portrait, rotatable.Orientation);
        }
コード例 #7
0
        private static void RotateDepthLayer <T>(DataCube <T> cube, int depth)
        {
            if (depth < 0 || depth > cube.Size)
            {
                throw new ArgumentOutOfRangeException("depth");
            }

            int max = cube.Size - 1;

            for (int i = 0; i < cube.Size / 2; i++)
            {
                for (int j = i; j < max - i; j++)
                {
                    T temp = cube[i, j, depth];

                    cube[i, j, depth]             = cube[max - j, i, depth];
                    cube[max - j, i, depth]       = cube[max - i, max - j, depth];
                    cube[max - i, max - j, depth] = cube[j, max - i, depth];
                    cube[j, max - i, depth]       = temp;
                }
            }

            for (int i = 0; i < cube.Size; i++)
            {
                for (int j = 0; j < cube.Size; j++)
                {
                    IRotatable rotatable = cube[i, j, depth] as IRotatable;
                    if (rotatable != null)
                    {
                        rotatable.RotateAroundDepth();
                    }
                }
            }
        }
コード例 #8
0
 public void Construct(IMovable movement, IRotatable rotatable, IWave wave, IKillable killable)
 {
     this.killable  = killable;
     this.movement  = movement;
     this.rotatable = rotatable;
     this.wave      = wave;
 }
コード例 #9
0
 public GateSpawner(IRotatable player, GateSettings settings)
 {
     _numInColumn = settings.NumInColumn;
     _gateBlock   = settings.GateBlock;
     _outerGate   = settings.OuterGate;
     _player      = player;
 }
コード例 #10
0
        /// <summary>
        /// Sets the orientation of the browser.
        /// </summary>
        /// <returns>This command always returns <see langword="null"/>.</returns>
        public override object Execute()
        {
            IRotatable rotatableDriver = Session.Driver as IRotatable;

            rotatableDriver.Orientation = this.orientation;
            return(null);
        }
コード例 #11
0
ファイル: ThreeDeeEditor.cs プロジェクト: RichardBradley/MMEd
        private void UpdateActiveObjectStatus(object xiObject)
        {
            string lStatus = "";

            Chunk lChunk = xiObject as Chunk;

            if (lChunk != null)
            {
                lStatus += lChunk.Name + " - ";
            }

            IPositionable lPos = xiObject as IPositionable;

            if (lPos != null)
            {
                lStatus += string.Format(" Pos: ({0},{1},{2})",
                                         lPos.OriginPosition.X,
                                         lPos.OriginPosition.Y,
                                         lPos.OriginPosition.Z);
            }

            IRotatable lRot = xiObject as IRotatable;

            if (lRot != null)
            {
                lStatus += string.Format(" Rot: ({0},{1},{2})",
                                         lRot.RotationVector.X,
                                         lRot.RotationVector.Y,
                                         lRot.RotationVector.Z);
            }

            mMainForm.ThreeDeeEditorStatusLabel.Text = lStatus;
        }
コード例 #12
0
    private void Rotate(bool right, IRotatable rot)
    {
        Direction newDir;
        Direction facing = rot.GetFacing();

        switch (facing)
        {
        case (Direction.NORTH):
            newDir = right ? Direction.EAST : Direction.WEST;
            break;

        case (Direction.EAST):
            newDir = right ? Direction.SOUTH : Direction.NORTH;
            break;

        case (Direction.SOUTH):
            newDir = right ? Direction.WEST : Direction.EAST;
            break;

        case (Direction.WEST):
            newDir = right ? Direction.NORTH : Direction.SOUTH;
            break;

        default:
            newDir = facing;
            break;
        }
        rot.SetDirection(newDir);
    }
コード例 #13
0
 // we need to remove blocks which makes impossible for player to traverse through gate.
 //We make them all prepared after first creation in Gate class
 private void OnTriggerEnter(Collider other)
 {
     if (!IsPrepared)
     {
         IRotatable player = other.GetComponentInParent <IRotatable>();
         if (player == null)
         {
             return;
         }
         IsPrepared = true;
         Disable();
     }
     else
     {
         ISpeedable playerSpeed = other.GetComponentInParent <ISpeedable>();
         if (playerSpeed == null)
         {
             return;
         }
         _isMoved  = true;
         _startPos = transform.position;
         playerSpeed.SlowDown();
         _rb.isKinematic = false;
         _rb.AddForce(Vector3.right, ForceMode.Impulse);
     }
 }
コード例 #14
0
ファイル: Animation.cs プロジェクト: klimentt/KurtVonnegut
 public void Draw(SpriteBatch spriteBatch, IRotatable rotatingObject)
 {
     // Only draw the animation when we are active
     if (this.Active)
     {
         spriteBatch.Draw(this.spriteStrip, this.destinationRect, this.sourceRect, Color.White, rotatingObject.Rotation, new Vector2(this.FrameWidth / 2, this.FrameHeight / 2), SpriteEffects.None, 0f);
     }
 }
コード例 #15
0
 private void Awake()
 {
     rotator         = GetComponent <IRotatable> ();
     shooting        = GetComponent <IShooting> ();
     magazineManager = GetComponent <IWeaponMagazineManager> ();
     magazineManager.Initialize(stats);
     shooting.Initialize(stats);
 }
コード例 #16
0
    void Awake()
    {
        // Initialize references between objects
        tankCtrl   = GetComponent <IMovable <sbyte> > ();
        turretCtrl = GetComponent <IRotatable> ();
        weaponCtrl = GetComponent <IShootable> ();

        //NetworkServer.Spawn (tankCtrl.gameObject);
    }
コード例 #17
0
        public void HandleEvent(IRotatable sender, RotateEventArgs e)
        {
            if (sender == null || e == null)
            {
                return;
            }

            if (e.Direction != LastDirection)
            {
                DirectionChanged = true;
                LastDirection    = e.Direction;
            }
            else
            {
                DirectionChanged = false;
            }

            if (e.Direction == RotatingDirections.None)
            {
                return;
            }

            if (sender is Polyomino)
            {
                Polyomino polyomino = sender as Polyomino;

                if (DirectionChanged)
                {
                    foreach (Mino mino in polyomino.Minoes)
                    {
                        Vector2 vector = mino.Position - polyomino.OriginMino.Position;
                        float   r      = 0;
                        switch (e.Direction)
                        {
                        case RotatingDirections.Clockwise:
                            r = +MathHelper.PiOver2;
                            break;

                        case RotatingDirections.Counterclockwise:
                            r = -MathHelper.PiOver2;
                            break;

                        default:
                            break;
                        }
                        var x = MathHelper.Clamp(Convert.ToSingle(vector.X * Math.Cos(r) - vector.Y * Math.Sin(r)), float.MinValue, float.MaxValue);
                        var y = MathHelper.Clamp(Convert.ToSingle(vector.X * Math.Sin(r) + vector.Y * Math.Cos(r)), float.MinValue, float.MaxValue);
                        mino.Position = polyomino.OriginMino.Position + new Vector2(x, y);
                    }
                }
            }
        }
コード例 #18
0
ファイル: Projectile.cs プロジェクト: klimentt/KurtVonnegut
        public void Initialize(Viewport viewport, Texture2D texture, Vector2 position, IRotatable shooter)
        {
            this.Texture = texture;
            this.Position = position;
            this.viewport = viewport;
            this.Rotation = shooter.Rotation;

            this.Active = true;

            this.Damage = DAMAGE;

            this.projectileMoveSpeed = SPEED;
        }
コード例 #19
0
ファイル: Program.cs プロジェクト: Lepilov/CsharpCourse
        static void Main(string[] args)
        {
            Console.Write("Введите кол-во колес : ");
            uint countWheels;

            if (!Utils.TryEnterNumberFromConsole(out countWheels))
            {
                HandleIncorrectEntar();
                return;
            }

            Console.Write("Введите кол-во дверей : ");
            uint countDoors;

            if (!Utils.TryEnterNumberFromConsole(out countDoors))
            {
                HandleIncorrectEntar();
                return;
            }

            Car car = new Car((int)countWheels, (int)countDoors, "Запорожец");

            foreach (Detail detail in car.Details)
            {
                IRotatable rotatableDetail = detail as IRotatable;
                if (rotatableDetail != null)
                {
                    rotatableDetail.Move();
                }
            }

            Console.Write("Введите номер двери : ");
            uint doorNumber;

            if (Utils.TryEnterNumberFromConsole(out doorNumber))
            {
                HandleIncorrectEntar();
                return;
            }
            foreach (Detail detail in car.Details)
            {
                Door door = detail as Door;
                if (door != null && door.Number == doorNumber - 1)
                {
                    door.Open();
                    break;
                }
            }

            Console.Read();
        }
コード例 #20
0
        private void Unregister(IRotatable obj, IList <IRotatable> list)
        {
            if (list == null)
            {
                return;
            }

            var index = list.IndexOf(obj);

            if (index > -1)
            {
                list.RemoveAt(index);
            }
        }
コード例 #21
0
        private void PerformDraggingObjectControl()
        {
            Cursor cursor = GuiManager.Cursor;

            if (mObjectGrabbed == null || cursor.WindowOver != null)
            {
                return;
            }

            #region Move

            if (GuiData.ToolsWindow.MoveButton.IsPressed)
            {
                PositionedObjectMover.MouseMoveObject(mObjectGrabbed);
            }

            #endregion

            #region Scale

            else if (GuiData.ToolsWindow.ScaleButton.IsPressed && mObjectGrabbed is IScalable)
            {
                cursor.StaticPosition = true;

                IScalable asIScalable = mObjectGrabbed as IScalable;

                asIScalable.ScaleX *= 1 + cursor.XVelocity / 100.0f;
                asIScalable.ScaleY *= 1 + cursor.YVelocity / 100.0f;
            }

            #endregion

            #region Rotate

            else if (GuiData.ToolsWindow.RotateButton.IsPressed && mObjectGrabbed is IRotatable)
            {
                cursor.StaticPosition = true;

                IRotatable asiRotatable = mObjectGrabbed as IRotatable;

                asiRotatable.RotationZ += cursor.YVelocity * SpriteManager.Camera.Z / 100.0f;

                if (mObjectGrabbed.Parent != null)
                {
                    mObjectGrabbed.SetRelativeFromAbsolute();
                }
            }

            #endregion
        }
コード例 #22
0
        private static async Task PermuteAntiClockwise(IRotatable configuration, ICollection<IRotation> solution)
        {
            await CommonActions.ApplyAndAddRotation(Rotations.RightClockwise, solution, configuration).ConfigureAwait(false);

            await CommonActions.ApplyAndAddRotation(Rotations.UpperClockwise, solution, configuration).ConfigureAwait(false);

            await CommonActions.ApplyAndAddRotation(Rotations.RightAntiClockwise, solution, configuration).ConfigureAwait(false);

            await CommonActions.ApplyAndAddRotation(Rotations.UpperClockwise, solution, configuration).ConfigureAwait(false);

            await CommonActions.ApplyAndAddRotation(Rotations.RightClockwise, solution, configuration).ConfigureAwait(false);

            await CommonActions.ApplyAndAddRotation(Rotations.Upper2, solution, configuration).ConfigureAwait(false);

            await CommonActions.ApplyAndAddRotation(Rotations.RightAntiClockwise, solution, configuration).ConfigureAwait(false);

        }
コード例 #23
0
    // Moving logic
    private void DoJump(IRotatable rotatable)
    {
        // Detect jump direction
        Vector3 direction = rotatable.GetDirection().ToVector3(transform);

        // Reverse axis direction if model/prefab axis reversed
        if (ReverseAxis)
        {
            direction *= -JumpDistance;
        }
        else
        {
            direction *= JumpDistance;
        }

        AnimateJump(direction);
    }
コード例 #24
0
ファイル: Entity.cs プロジェクト: Dzugaru/hexes
        public virtual void UpdateInterface()
        {
            if (this is IHasHP)
            {
                Interfacing.PerformInterfaceUpdateHP(graphicsHandle, hasHP.currentHP, hasHP.maxHP);
            }

            IRotatable rotatable = this as IRotatable;

            if (rotatable != null)
            {
                if (rotatable.CanRotate)
                {
                    Interfacing.PerformInterfaceUpdateRotation(graphicsHandle, dir);
                }
            }
        }
コード例 #25
0
    void ThrowFire()
    {
        if (!throwingFire)
        {
            Vector3 offset = target.transform.position - rotator.transform.position;
            offset.Normalize();
            offset = new Vector3(offset.x * posMultiplier, offset.y + posUpper, offset.z * posMultiplier);

            currentFire = (GameObject)Instantiate(fire, rotator.position + offset, Quaternion.identity);
            currentFire.transform.parent = rotator;
            if (currentFire != null)
            {
                IRotatable bc = currentFire.GetComponent <IRotatable>();
                bc.SetRotation(rotator.rotation.eulerAngles.y);
            }
        }
        throwingFire = true;
    }
コード例 #26
0
        protected virtual void DrawObjectLayers(RendererBase <ToyWorld> renderer, ToyWorld world)
        {
            var gridView = GridView;

            Effect.TileTypesIdxOffsetUniform(0);
            GL.BindBuffer(BufferTarget.PixelUnpackBuffer, 0);

            // Draw objects
            foreach (var objectLayer in world.Atlas.ObjectLayers)
            {
                foreach (var gameObject in objectLayer.GetGameObjects(new RectangleF(gridView)))
                {
                    if (IgnoredGameObjects.Contains(gameObject) || gameObject.Invisible)
                    {
                        continue;
                    }

                    // Set up transformation to screen space for the gameObject
                    Matrix transform = Matrix.Identity;
                    // Model transform
                    IRotatable rotatableObject = gameObject as IRotatable;
                    if (rotatableObject != null)
                    {
                        transform *= Matrix.CreateRotationZ(rotatableObject.Rotation);
                    }
                    transform *= Matrix.CreateScale(new Vector3(gameObject.Size, objectLayer.Thickness) * 0.5f); // from (-1,1) to (-size,size)/2
                    // World transform
                    transform *= Matrix.CreateTranslation(new Vector3(gameObject.Position, objectLayer.SpanIntervalFrom + objectLayer.Thickness / 2));
                    // View and projection transforms
                    transform *= Owner.ViewProjectionMatrix;
                    Effect.ModelViewProjectionUniform(ref transform);

                    // Setup dynamic data
                    LocalTileTypesBuffer[0] = (ushort)gameObject.TilesetId;
                    TileTypesTexure.Update1D(1, dataType: PixelType.UnsignedShort, data: LocalTileTypesBuffer);
                    Cube.Draw();
                }
            }
        }
コード例 #27
0
        public static async Task ApplyAndAddRotation(IRotation rotation, ICollection<IRotation> rotations, IRotatable configuration)
        {
            if (rotation == null) return;

            rotations.Add(rotation);

            var cubeRotation = rotation as CubeRotation;
            var faceRotation = rotation as FaceRotation;
            if (cubeRotation != null)
            {
                await configuration.RotateCube(cubeRotation).ConfigureAwait(false);
            }
            if (faceRotation != null)
            {
                await configuration.Rotate(faceRotation).ConfigureAwait(false);
            }
        }
コード例 #28
0
 public Block(Position[,] block)
 {
     this.blocks    = block;
     blockRotation  = new BlockRotation();
     blockCollision = new BlockCollision();
 }
コード例 #29
0
ファイル: TetrisUtility.cs プロジェクト: Sweeper777/MineTris
 /// <summary>
 /// Adds the rotation index by one.
 /// </summary>
 public static void AddRotationIndex (IRotatable tetrimino) {
     try {
         tetrimino.RotationIndex++;
     } catch (ArgumentException) {
         tetrimino.RotationIndex = 0;
     }
 }
コード例 #30
0
ファイル: ThreeDeeEditor.cs プロジェクト: RichardBradley/MMEd
        void MainForm_KeyDown(object sender, KeyEventArgs e)
        {
            if (mActiveSurface == null)
            {
                return;
            }

            Camera lCamera = mViews[mActiveSurface].Camera;

            if (lCamera.ProjectionMode != eProjectionMode.Orthographic)
            {
                return;
            }

            if (Control.ModifierKeys == Keys.Shift)
            {
                IRotatable lObject = ActiveObject as IRotatable;
                if (lObject == null)
                {
                    return;
                }

                double lDelta;
                switch (e.KeyCode)
                {
                case Keys.Up:
                    lDelta = 0.1;
                    break;

                case Keys.Down:
                    lDelta = -0.1;
                    break;

                case Keys.Right:
                    lDelta = 0.1;
                    break;

                case Keys.Left:
                    lDelta = -0.1;
                    break;

                default:
                    return;
                }

                if (Control.ModifierKeys != Keys.Control)
                {
                    lDelta /= 5;
                }

                lObject.RotationVector = Utils.RotationMatrixToShort3Coord(
                    Matrix.Rotation(lDelta, lCamera.ZAxis) * Utils.Short3CoordToRotationMatrix(lObject.RotationVector));
                RebuildObject(lObject);
                InvalidateAllViewers();
            }
            else
            {
                IPositionable lObject = ActiveObject as IPositionable;
                if (lObject == null)
                {
                    return;
                }

                Vector lDelta;
                switch (e.KeyCode)
                {
                case Keys.Up:
                    lDelta = lCamera.YAxis;
                    break;

                case Keys.Down:
                    lDelta = -lCamera.YAxis;
                    break;

                case Keys.Right:
                    lDelta = lCamera.XAxis;
                    break;

                case Keys.Left:
                    lDelta = -lCamera.XAxis;
                    break;

                default:
                    return;
                }

                if (Control.ModifierKeys != Keys.Control)
                {
                    lDelta *= 5;
                }

                lObject.OriginPosition.X += (short)(lDelta.x);
                lObject.OriginPosition.Y += (short)(lDelta.y);
                lObject.OriginPosition.Z -= (short)(lDelta.z);
            }

            RebuildObject(ActiveObject);
            InvalidateAllViewers();
        }
コード例 #31
0
ファイル: ThreeDeeEditor.cs プロジェクト: RichardBradley/MMEd
        void Viewer3DRenderingSurface_MouseMove(object sender, MouseEventArgs e)
        {
            if (!mDraggingView || mSubject == null)
            {
                return;
            }
            System.Drawing.Point lNewMousePoint = e.Location;

            RenderingSurface lSender = sender as RenderingSurface;
            Camera           lCamera = mViews[lSender].Camera;

            if (mDraggingButton == MouseButtons.Left)
            {
                if (Control.ModifierKeys == Keys.Alt && lCamera.ProjectionMode == eProjectionMode.Orthographic)
                {
                    IPositionable lObject = ActiveObject as IPositionable;
                    if (lObject != null)
                    {
                        double lDeltaX = (lNewMousePoint.X - mLastMouseDown.X);
                        // Origin is at bottom-left, but mouse position is measured from orign at top-left (or vice versa)
                        double lDeltaY = -(lNewMousePoint.Y - mLastMouseDown.Y);
                        double lScale  = (lCamera.Position.GetPositionVector() * lCamera.ZAxis) / lSender.Width;
                        Vector lDelta  = ((lDeltaX * lCamera.XAxis) + (lDeltaY * lCamera.YAxis)) * lScale;
                        lObject.OriginPosition.X += (short)(lDelta.x);
                        lObject.OriginPosition.Y += (short)(lDelta.y);
                        // MMs has a left handed coordinate system, so the z-axis is pointing the "wrong" way
                        lObject.OriginPosition.Z -= (short)(lDelta.z);
                        RebuildObject(lObject);
                        InvalidateAllViewers();
                    }
                }
                else if (Control.ModifierKeys == Keys.Shift)
                {
                    IRotatable lObject = ActiveObject as IRotatable;
                    if (lObject != null)
                    {
                        double lDelta = (double)(lNewMousePoint.Y - mLastMouseDown.Y);
                        lObject.RotationVector = Utils.RotationMatrixToShort3Coord(
                            Matrix.Rotation(lDelta / 100, lCamera.ZAxis) * Utils.Short3CoordToRotationMatrix(lObject.RotationVector));
                        RebuildObject(lObject);
                        InvalidateAllViewers();
                    }
                }
                else if (lCamera.ProjectionMode == eProjectionMode.Perspective)
                {
                    switch (MovementMode)
                    {
                    case eMovementMode.FlyMode:
                        bool lCameraIsUpsideDown = lCamera.YAxis.Dot(Vector.ZAxis) < 0;
                        lCamera.Rotate(0.01 * (lNewMousePoint.X - mLastMouseDown.X), lCameraIsUpsideDown ? Vector.ZAxis : -Vector.ZAxis);
                        lCamera.Rotate(0.01 * (lNewMousePoint.Y - mLastMouseDown.Y), lCamera.XAxis);
                        break;

                    case eMovementMode.InspectMode:
                        lCamera.RotateAboutWorldOrigin(0.01 * (lNewMousePoint.X - mLastMouseDown.X), lCamera.YAxis);
                        lCamera.RotateAboutWorldOrigin(0.01 * (lNewMousePoint.Y - mLastMouseDown.Y), lCamera.XAxis);
                        break;

                    default: throw new Exception("Unreachable case");
                    }
                }
            }
            if (mDraggingButton == MouseButtons.Right)
            {
                if (Control.ModifierKeys == Keys.Alt)
                {
                }
                else if (Control.ModifierKeys == Keys.Shift)
                {
                }
                else
                {
                    if (lCamera.ProjectionMode == eProjectionMode.Orthographic)
                    {
                        double lScale = (lCamera.Position.GetPositionVector() * lCamera.ZAxis) / lSender.Width;
                        lCamera.Move(-lScale * (lNewMousePoint.X - mLastMouseDown.X) * lCamera.XAxis);
                        lCamera.Move(lScale * (lNewMousePoint.Y - mLastMouseDown.Y) * lCamera.YAxis);
                    }
                    else
                    {
                        if (lCamera.ProjectionMode == eProjectionMode.Perspective && MovementMode == eMovementMode.FlyMode)
                        {
                            lCamera.Move(0.1 * MoveScale * (lNewMousePoint.X - mLastMouseDown.X) * lCamera.XAxis);
                            lCamera.Move(0.1 * MoveScale * (lNewMousePoint.Y - mLastMouseDown.Y) * lCamera.YAxis);
                        }
                    }
                }
            }
            mLastMouseDown = lNewMousePoint;
            lSender.Invalidate();
        }
コード例 #32
0
        private static async Task MoveTopCornerToBottom(IRotatable configuration, ICollection<IRotation> solution)
        {
            // Move into top layer
            await CommonActions.ApplyAndAddRotation(Rotations.RightClockwise, solution, configuration).ConfigureAwait(false);

            await CommonActions.ApplyAndAddRotation(Rotations.Upper2, solution, configuration).ConfigureAwait(false);

            await CommonActions.ApplyAndAddRotation(Rotations.RightAntiClockwise, solution, configuration).ConfigureAwait(false);

            await CommonActions.ApplyAndAddRotation(Rotations.UpperAntiClockwise, solution, configuration).ConfigureAwait(false);


            // Move to bottom face
            await CommonActions.ApplyAndAddRotation(Rotations.RightClockwise, solution, configuration).ConfigureAwait(false);

            await CommonActions.ApplyAndAddRotation(Rotations.UpperClockwise, solution, configuration).ConfigureAwait(false);

            await CommonActions.ApplyAndAddRotation(Rotations.RightAntiClockwise, solution, configuration).ConfigureAwait(false);

        }
コード例 #33
0
        public static bool IsHorizontal(IRotatable symbol)
        {
            Rotation rotation = symbol.Rotation;

            return(rotation == Rotation.Right || rotation == Rotation.Left);
        }
コード例 #34
0
 public void Construct(IRotatable rotatable, ISpawner <Photon> spawner, IWave wave)
 {
     this.rotatable = rotatable;
     this.spawner   = spawner;
     this.wave      = wave;
 }
コード例 #35
0
        private static async Task MoveTopCentreToMiddleRight(IRotatable configuration, ICollection<IRotation> solution)
        {
            await CommonActions.ApplyAndAddRotation(Rotations.UpperClockwise, solution, configuration).ConfigureAwait(false);

            await CommonActions.ApplyAndAddRotation(Rotations.RightClockwise, solution, configuration).ConfigureAwait(false);

            await CommonActions.ApplyAndAddRotation(Rotations.UpperAntiClockwise, solution, configuration).ConfigureAwait(false);

            await CommonActions.ApplyAndAddRotation(Rotations.RightAntiClockwise, solution, configuration).ConfigureAwait(false);

            await CommonActions.ApplyAndAddRotation(Rotations.FrontClockwise, solution, configuration).ConfigureAwait(false);

            await CommonActions.ApplyAndAddRotation(Rotations.RightAntiClockwise, solution, configuration).ConfigureAwait(false);

            await CommonActions.ApplyAndAddRotation(Rotations.FrontAntiClockwise, solution, configuration).ConfigureAwait(false);

            await CommonActions.ApplyAndAddRotation(Rotations.RightClockwise, solution, configuration).ConfigureAwait(false);

        }
コード例 #36
0
ファイル: MovementPhysics.cs プロジェクト: realisticen/TINR
 public static void simulateMovement(IRotatable obj, GameTime time)
 {
     obj.RotationAngle += obj.AngularVelocity * (float)time.ElapsedGameTime.TotalSeconds;
 }
コード例 #37
0
 private static async Task HorizontalLineToCross(IRotatable configuration, ICollection<IRotation> solution)
 {
     await CommonActions.ApplyAndAddRotation(Rotations.FrontClockwise, solution, configuration).ConfigureAwait(false);
     await CommonActions.ApplyAndAddRotation(Rotations.RightClockwise, solution, configuration).ConfigureAwait(false);
     await CommonActions.ApplyAndAddRotation(Rotations.UpperClockwise, solution, configuration).ConfigureAwait(false);
     await CommonActions.ApplyAndAddRotation(Rotations.RightAntiClockwise, solution, configuration).ConfigureAwait(false);
     await CommonActions.ApplyAndAddRotation(Rotations.UpperAntiClockwise, solution, configuration).ConfigureAwait(false);
     await CommonActions.ApplyAndAddRotation(Rotations.FrontAntiClockwise, solution, configuration).ConfigureAwait(false);
 }
コード例 #38
0
        private static async Task<bool> PermuteAllSame(Dictionary<FaceType, RelativePosition> relativePositions, IRotatable configuration, ICollection<IRotation> solution)
        {
            if (relativePositions == null || !relativePositions.Any()) return false;

            var first = relativePositions.First().Value;

            if (relativePositions.Values.Skip(1).Any(p => p != first)) return false;

            switch (first)
            {
                case RelativePosition.Right:
                    await CommonActions.ApplyAndAddRotation(Rotations.UpperAntiClockwise, solution, configuration).ConfigureAwait(false);

                    break;

                case RelativePosition.Left:
                    await CommonActions.ApplyAndAddRotation(Rotations.UpperClockwise, solution, configuration).ConfigureAwait(false);

                    break;

                case RelativePosition.Opposite:
                    await CommonActions.ApplyAndAddRotation(Rotations.Upper2, solution, configuration).ConfigureAwait(false);

                    break;
            }

            return true;
        }
コード例 #39
0
        /// <summary>
        /// Gets the orientation of the browser.
        /// </summary>
        /// <returns>A value containing the orientation of the browser.</returns>
        public override object Execute()
        {
            IRotatable rotatableDriver = Session.Driver as IRotatable;

            return(rotatableDriver.Orientation.ToString().ToUpperInvariant());
        }
コード例 #40
0
        private static async Task RightFace(ICollection<IRotation> solution, IRotatable configuration)
        {
            for (int i = 0; i < 2; i++)
            {
                await CommonActions.ApplyAndAddRotation(Rotations.RightClockwise, solution, configuration).ConfigureAwait(false);

                await CommonActions.ApplyAndAddRotation(Rotations.DownClockwise, solution, configuration).ConfigureAwait(false);

                await CommonActions.ApplyAndAddRotation(Rotations.RightAntiClockwise, solution, configuration).ConfigureAwait(false);

                await CommonActions.ApplyAndAddRotation(Rotations.DownAntiClockwise, solution, configuration).ConfigureAwait(false);

            }
        }