Ejemplo n.º 1
0
 public Planet(string name, int speed, RotationEnum rotation, int radius, int day)
     : base(name)
 {
     Speed    = speed;
     Rotation = rotation;
     Radius   = radius;
     SetPosition(day);
 }
Ejemplo n.º 2
0
        public WindowRect Rotate(RotationEnum newAngle)
        {
            WindowRect wrBlock = new WindowRect();

            Angle = newAngle;
            Build();
            Adjustment(ref wrBlock);

            return(wrBlock);
        }
Ejemplo n.º 3
0
 public static SKSize Transform(this RotationEnum rotation, SKSize size)
 {
     if ((int)rotation % 180 == 0)
     {
         return(new SKSize(size.Width, size.Height));
     }
     else
     {
         return(new SKSize(size.Height, size.Width));
     }
 }
Ejemplo n.º 4
0
            /**
             * <summary>Gets the initial current transformation matrix.</summary>
             */
            public Matrix GetInitialCtm(
                )
            {
                Matrix initialCtm;

                if (Scanner.RenderContext == null) // Device-independent.
                {
                    initialCtm = new Matrix();     // Identity.
                }
                else // Device-dependent.
                {
                    IContentContext contentContext = Scanner.ContentContext;
                    SizeF           canvasSize     = Scanner.CanvasSize;

                    // Axes orientation.
                    RotationEnum rotation = contentContext.Rotation;
                    switch (rotation)
                    {
                    case RotationEnum.Downward:
                        initialCtm = new Matrix(1, 0, 0, -1, 0, canvasSize.Height);
                        break;

                    case RotationEnum.Leftward:
                        initialCtm = new Matrix(0, 1, 1, 0, 0, 0);
                        break;

                    case RotationEnum.Upward:
                        initialCtm = new Matrix(-1, 0, 0, 1, canvasSize.Width, 0);
                        break;

                    case RotationEnum.Rightward:
                        initialCtm = new Matrix(0, -1, -1, 0, canvasSize.Width, canvasSize.Height);
                        break;

                    default:
                        throw new NotImplementedException();
                    }

                    // Scaling.
                    RectangleF contentBox        = contentContext.Box;
                    SizeF      rotatedCanvasSize = rotation.Transform(canvasSize);
                    initialCtm.Scale(
                        rotatedCanvasSize.Width / contentBox.Width,
                        rotatedCanvasSize.Height / contentBox.Height
                        );

                    // Origin alignment.
                    initialCtm.Translate(-contentBox.Left, -contentBox.Top); //TODO: verify minimum coordinates!
                }
                return(initialCtm);
            }
            public static dynamic GetTSObject(RotationEnum dynEnum)
            {
                var tsType = TSActivator.CreateInstance("Tekla.Structures.Model.Position.RotationEnum").GetType();

                switch (dynEnum)
                {
                case RotationEnum.FRONT:
                    return(System.Enum.Parse(tsType, "FRONT"));

                case RotationEnum.TOP:
                    return(System.Enum.Parse(tsType, "TOP"));

                case RotationEnum.BACK:
                    return(System.Enum.Parse(tsType, "BACK"));

                case RotationEnum.BELOW:
                    return(System.Enum.Parse(tsType, "BELOW"));

                default:
                    throw new DynamicAPIException(dynEnum.ToString() + "- enum value is not implemented");
                }
            }
	public void RotateX( RotationEnum direction )
	{
		if ( direction == RotationEnum.Clockwise )
		{
			// Update all of the edge nodes with their new neighbors.
			Nodes[ 0, 5 ].ReplaceNeighbor( Nodes[ 1, 0 ], Nodes[ 0, 2 ] );
			Nodes[ 0, 6 ].ReplaceNeighbor( Nodes[ 2, 0 ], Nodes[ 0, 1 ] );
			Nodes[ 1, 7 ].ReplaceNeighbor( Nodes[ 3, 1 ], Nodes[ 1, 0 ] );
			Nodes[ 2, 7 ].ReplaceNeighbor( Nodes[ 3, 2 ], Nodes[ 2, 0 ] );
			Nodes[ 3, 6 ].ReplaceNeighbor( Nodes[ 2, 4 ], Nodes[ 3, 1 ] );
			Nodes[ 3, 5 ].ReplaceNeighbor( Nodes[ 1, 4 ], Nodes[ 3, 2 ] );
			Nodes[ 2, 4 ].ReplaceNeighbor( Nodes[ 0, 1 ], Nodes[ 2, 3 ] );
			Nodes[ 1, 4 ].ReplaceNeighbor( Nodes[ 0, 2 ], Nodes[ 1, 3 ] );

			// Transform all of the affected nodes by 90 degrees in the array.
			var temp = Nodes[ 0, 5 ];
			Nodes[ 0, 5 ] = Nodes[ 2, 4 ];
			Nodes[ 2, 4 ] = Nodes[ 3, 6 ];
			Nodes[ 3, 6 ] = Nodes[ 1, 7 ];
			Nodes[ 1, 7 ] = temp;
			temp = Nodes[ 0, 6 ];
			Nodes[ 0, 6 ] = Nodes[ 1, 4 ];
			Nodes[ 1, 4 ] = Nodes[ 3, 5 ];
			Nodes[ 3, 5 ] = Nodes[ 2, 7 ];
			Nodes[ 2, 7 ] = temp;
			temp = Nodes[ 1, 5 ];
			Nodes[ 1, 5 ] = Nodes[ 2, 5 ];
			Nodes[ 2, 5 ] = Nodes[ 2, 6 ];
			Nodes[ 2, 6 ] = Nodes[ 1, 6 ];
			Nodes[ 1, 6 ] = temp;
		}
		else
		{
			throw new NotImplementedException( "CCW rotation isn't in yet!" );
		}
	}
Ejemplo n.º 7
0
 /// <remarks>THIS IS NOT YET IMPLEMENTED!</remarks>
 /// <summary>
 /// Rotate a CubicHexCoord around this CubicHexCoord by the given rotation (constrained to 
 /// exact 60 degree rotation steps) and return the CubicHexCoord that represents the 
 /// rotated position in the grid.
 /// </summary>
 /// <param name="toRotate">The CubicHexCoord to be rotated around this CubicHexCoord.</param>
 /// <param name="rotation">The direction and magnitude of rotation to be applied (in exact 
 /// 60 degree rotation steps.</param>
 /// <returns>A CubicHexCoord representing the position of the rotated hex on the grid.
 /// </returns>
 public CubicHexCoord RotateOtherAround( CubicHexCoord toRotate, RotationEnum rotation )
 {
     return CubicHexCoord.Rotate( this, toRotate, rotation );
 }
Ejemplo n.º 8
0
 /// <remarks>THIS IS NOT YET IMPLEMENTED!</remarks>
 /// <summary>
 /// Rotate this CubicHexCoord around the given center by the given rotation (constrained to 
 /// exact 60 degree rotation steps) and return the CubicHexCoord that represents the 
 /// rotated position in the grid.
 /// </summary>
 /// <param name="center">The CubicHexCoord to be rotated around this CubicHexCoord.</param>
 /// <param name="rotation">The direction and magnitude of rotation to be applied (in exact 
 /// 60 degree rotation steps.</param>
 /// <returns>A CubicHexCoord representing the position of the rotated hex on the grid.
 /// </returns>
 public CubicHexCoord RotateAroundOther( CubicHexCoord center, RotationEnum rotation )
 {
     return CubicHexCoord.Rotate( center, this, rotation );
 }
Ejemplo n.º 9
0
 /// <remarks>THIS IS NOT YET IMPLEMENTED!</remarks>
 /// <see cref="http://www.redblobgames.com/grids/hexagons/"/>
 /// <summary>
 /// Rotate a CubicHexCoord around the given center by the given rotation (constrained to 
 /// exact 60 degree rotation steps) and return the CubicHexCoord that represents the 
 /// rotated position in the grid.
 /// </summary>
 /// <param name="center">The CubicHexCoord representing the rotation's pivot.</param>
 /// <param name="toRotate">The CubicHexCoord to be rotated around the pivot.</param>
 /// <param name="rotation">The direction and magnitude of rotation to be applied (in exact 
 /// 60 degree rotation steps.</param>
 /// <returns>A CubicHexCoord representing the position of the rotated hex on the grid.
 /// </returns>
 public static CubicHexCoord Rotate( CubicHexCoord center, CubicHexCoord toRotate, RotationEnum rotation )
 {
     throw new NotImplementedException( "Feature not suppored yet!" );
 }
Ejemplo n.º 10
0
 /// <remarks>THIS IS NOT YET IMPLEMENTED!</remarks>
 /// <see cref="http://www.redblobgames.com/grids/hexagons/"/>
 /// <summary>
 /// Rotate a CubicHexCoord around the given center by the given rotation (constrained to
 /// exact 60 degree rotation steps) and return the CubicHexCoord that represents the
 /// rotated position in the grid.
 /// </summary>
 /// <param name="center">The CubicHexCoord representing the rotation's pivot.</param>
 /// <param name="toRotate">The CubicHexCoord to be rotated around the pivot.</param>
 /// <param name="rotation">The direction and magnitude of rotation to be applied (in exact
 /// 60 degree rotation steps.</param>
 /// <returns>A CubicHexCoord representing the position of the rotated hex on the grid.
 /// </returns>
 public static CubicHexCoord Rotate(CubicHexCoord center, CubicHexCoord toRotate, RotationEnum rotation)
 {
     throw new NotImplementedException("Feature not suppored yet!");
 }
Ejemplo n.º 11
0
 /// <remarks>THIS IS NOT YET IMPLEMENTED!</remarks>
 /// <summary>
 /// Rotate a CubicHexCoord around this CubicHexCoord by the given rotation (constrained to
 /// exact 60 degree rotation steps) and return the CubicHexCoord that represents the
 /// rotated position in the grid.
 /// </summary>
 /// <param name="toRotate">The CubicHexCoord to be rotated around this CubicHexCoord.</param>
 /// <param name="rotation">The direction and magnitude of rotation to be applied (in exact
 /// 60 degree rotation steps.</param>
 /// <returns>A CubicHexCoord representing the position of the rotated hex on the grid.
 /// </returns>
 public CubicHexCoord RotateOtherAround(CubicHexCoord toRotate, RotationEnum rotation)
 {
     return(CubicHexCoord.Rotate(this, toRotate, rotation));
 }
Ejemplo n.º 12
0
 /// <remarks>THIS IS NOT YET IMPLEMENTED!</remarks>
 /// <summary>
 /// Rotate this CubicHexCoord around the given center by the given rotation (constrained to
 /// exact 60 degree rotation steps) and return the CubicHexCoord that represents the
 /// rotated position in the grid.
 /// </summary>
 /// <param name="center">The CubicHexCoord to be rotated around this CubicHexCoord.</param>
 /// <param name="rotation">The direction and magnitude of rotation to be applied (in exact
 /// 60 degree rotation steps.</param>
 /// <returns>A CubicHexCoord representing the position of the rotated hex on the grid.
 /// </returns>
 public CubicHexCoord RotateAroundOther(CubicHexCoord center, RotationEnum rotation)
 {
     return(CubicHexCoord.Rotate(center, this, rotation));
 }
Ejemplo n.º 13
0
 public StructBlock(RotationEnum newAngle, BlockTypeNum newType)
 {
     this.angle = newAngle;
     this.type  = newType;
 }
	IEnumerator RotateCoroutine( RotationAxis axis, RotationEnum direction, float speed )
	{
		if ( IsRotating )
		{
			yield break;
		}

		if ( SpinSpeed < float.Epsilon )
		{
			Debug.LogError( "SpinSpeed is less than or equal to 0" );
			yield break;
		}

		RotationCollider activeCollider = null;
		switch ( axis )
		{
			case RotationAxis.X: activeCollider = XRotationCollider; break;
			case RotationAxis.Y: activeCollider = YRotationCollider; break;
			case RotationAxis.Z: activeCollider = ZRotationCollider; break;
		}

		if ( activeCollider == null )
		{
			Debug.Log( "WHHAATT" );
			yield break;
		}

		Transform[] transformArray;
		Transform[] transformParentArray;
		{
			var quadList = activeCollider.GetAllObjectsToMove();

			transformArray = quadList.Select( o => o.transform ).ToArray();

			transformParentArray = transformArray.Select( t => t.parent ).ToArray();
		}

		Vector3? rotationAxis = null;
		if ( direction == RotationEnum.Clockwise )
		{
			switch ( axis )
			{
				case RotationAxis.X: rotationAxis = new Vector3( x: 1, y: 0, z: 0 ); break;
				case RotationAxis.Y: rotationAxis = new Vector3( x: 0, y: 1, z: 0 ); break;
				case RotationAxis.Z: rotationAxis = new Vector3( x: 0, y: 0, z: 1 ); break;
			}
		}
		else
		{
			switch ( axis )
			{
				case RotationAxis.X: rotationAxis = new Vector3( x: -1, y: 0, z: 0 ); break;
				case RotationAxis.Y: rotationAxis = new Vector3( x: 0, y: -1, z: 0 ); break;
				case RotationAxis.Z: rotationAxis = new Vector3( x: 0, y: 0, z: -1 ); break;
			}
		}

		if ( rotationAxis == null )
		{
			Debug.Log( "WWWHHHHAATTT" );
			yield break;
		}

		//switch ( axis )
		//{
		//	case RotationAxis.X: Graph.RotateX( direction ); break;
		//	case RotationAxis.Y: Graph.RotateY( direction ); break;
		//	case RotationAxis.Z: Graph.RotateZ( direction ); break;
		//}
		
		IsRotating = true;
		CenterTransform.rotation = Quaternion.identity;
		for ( var i = 0; i < transformArray.Length; i++ )
		{
			transformArray[ i ].parent = CenterTransform;
		}

		var progress = 0f;

		while ( progress < 1f )
		{
			var angle = RotationCurve.Evaluate( progress );
			CenterTransform.rotation = Quaternion.Euler( angle * rotationAxis.Value );
			progress += Time.deltaTime * speed;
	
			yield return null;
		}

		CenterTransform.rotation = Quaternion.Euler( 90 * rotationAxis.Value ); 

		for ( var i = 0; i < transformArray.Length; i++ )
		{
			transformArray[ i ].parent = transformParentArray[ i ];
		}

		CenterTransform.rotation = Quaternion.identity;

		yield return new WaitForSeconds( .1f );
		IsRotating = false;
		yield return null;
		yield return null;
	}
Ejemplo n.º 15
0
 public Inputs(MovementEnum movementType, RotationEnum rotationType, ShootEnum shoot)
 {
     this.MovementType = movementType;
     this.RotationType = rotationType;
     this.ShootState   = shoot;
 }