Inheritance: MonoBehaviour
コード例 #1
0
	// Use this for initialization
	protected override void Start () 
	{
		base.Start ();

		innerRotate = transform.FindChild ("Sprite").GetComponent<Rotate> ();
		outterRotate = GetComponent<Rotate> ();

		int totalRows = Mathf.Min(minionsQty / minionsPerRow);

		//create minions
		for(byte j = 1; j <= totalRows; j++)
		{
			int minionsOnThisRow = Mathf.Min(minionsQty - ((j - 1)  * minionsPerRow), minionsPerRow);
			float initialSpawnAngle = ((float)j / (float)totalRows) * (360f / minionsOnThisRow);
			float distance = minionsDistance + (minionsDistance * 0.4f * (j - 1));

			for(byte i = 0; i < minionsOnThisRow; i++)
			{
				float angle = initialSpawnAngle + (i * (360f / minionsOnThisRow)) * Mathf.Deg2Rad;

				Vector3 pos = new Vector3(Mathf.Cos(angle), Mathf.Sin(angle), 0f) * distance;
				Quaternion rot = Quaternion.Euler(0f, 0f, UnityEngine.Random.Range(0f, 360f));

				GameObject obj = Instantiate(minion) as GameObject;
				obj.transform.parent = transform.FindChild("Minions");
				obj.transform.localPosition = pos;
				obj.transform.rotation = rot;

				if(OnMinionSpawned != null)
					OnMinionSpawned(obj);
			}
		}
	}
コード例 #2
0
 public void RotateBlock(Rotate rotate, int count = 1)
 {
     switch (rotate) {
         case Rotate.Left:
             Orientation -= count;
             break;
         case Rotate.Right:
             Orientation += count;
             break;
     }
 }
コード例 #3
0
    private void CameraPosition()
    {
        if (mRotate == Rotate.Stop)
        {
            mPreviousCardinalPosition = mCardinalPosition;
            //Debug.Log("Cardinal position: " + mCardinalPosition);
        }
        /*else
            Debug.Log("Going from " + mPreviousCardinalPosition + " to " + mCardinalPosition);*/



        float speed = cameraSpeed * Time.deltaTime;

        float angleDifference = Mathf.Abs(rotation.y - nextRotation.y);
        if (angleDifference <= speed)
        {
            rotation = nextRotation;
            transform.rotation = Quaternion.Euler(rotation);
            mRotate = Rotate.Stop;
        }

        switch (mRotate)
        {
            case Rotate.Left:
                rotation.y += speed;
                transform.rotation = Quaternion.Euler(rotation);
                break;
            case Rotate.Right:
                rotation.y -= speed;
                transform.rotation = Quaternion.Euler(rotation);
                break;
        }

        if (nextRotation.y < 0)
            nextRotation.y += 360;

        if (nextRotation.y > 360)
            nextRotation.y -= 360;

        if(rotation.y < 0)
        {
            rotation.y += 360;
            transform.rotation = Quaternion.Euler(rotation);
        }
        if (rotation.y > 360)
        {
            rotation.y -= 360;
            transform.rotation = Quaternion.Euler(rotation);
        }


    }
コード例 #4
0
        public MAX7219(int numberOfPanels = 1, Rotate rotate = Rotate.None, Transform transform = Transform.None, ChipSelect chipSelect = ChipSelect.CE0, string SPIControllerName = "SPI0")
        {
            this.PanelsPerFrame = numberOfPanels < 0 ? 0 : numberOfPanels;
            this.rotate = rotate;
            this.transform = transform;
            this.chipSelect = chipSelect;
            this.SPIControllerName = SPIControllerName;

            SendDataBytes = new byte[2 * PanelsPerFrame];

            Task.Run(() => InitSpi()).Wait();
            InitDisplay();
        }
コード例 #5
0
        /// <summary>
        /// Initializes a new instance of the Ht16K33 I2C controller as found on the Adafriut Mini LED Matrix.
        /// </summary>
        /// <param name="frame">On or Off - defaults to On</param>
        /// <param name="brightness">Between 0 and 15</param>
        /// <param name="blinkrate">Defaults to Off.  Blink rates Fast = 2hz, Medium = 1hz, slow = 0.5hz</param>
        public Ht16K33(byte[] I2CAddress = null, Rotate rotate = Rotate.None, Display frame = LedDriver.Display.On, byte brightness = 2, BlinkRate blinkrate = BlinkRate.Off, string I2cControllerName = "I2C1") {

            Columns = 8;
            Rows = 8;
            this.rotate = rotate;
            this.brightness = brightness;
            this.I2cControllerName = I2cControllerName;

            if (I2CAddress == null) {
                this.I2CAddress = new byte[] { 0x70 };
            }
            else {
                this.I2CAddress = I2CAddress;
            }

            this.PanelsPerFrame = this.I2CAddress.Length;
            this.i2cDevice = new I2cDevice[PanelsPerFrame];

            currentFrameState = frameStates[(byte)frame];
            currentBlinkrate = blinkRates[(byte)blinkrate];

            Initialize();
        }
コード例 #6
0
ファイル: Rotate.cs プロジェクト: SunShuyi/FYP
    // Use this for initialization
    void Start()
    {
        sRotate = this;
        MinimumRotateDuration = 15.0f;
        MaximumRotateDuration = 35.0f;
        ShakeIntensity = ShakeIntensityValue = 0.15f;
        ShakeDecay = ShakeDecayValue = 0.035f;
        SkipFrame = SkipFrameCount = 7;

        Shaking = false;
        ReadyToRotate = false;

        Invoke ("DoShake", Random.Range (MinimumRotateDuration, MaximumRotateDuration));
    }
コード例 #7
0
        internal void Rotate(int Xindex, int Yindex, Rotate Direction, int Count = 1, bool undo = false)
        {
            if (Board[Yindex, Xindex].Type == BlockType.Chest)
                return;
            if (!(Xindex == 0 && Yindex == 0) && !(Xindex == 0 && Yindex == Board.GetLength(0) - 1) &&
                !(Xindex == Board.GetLength(1) - 1 && Yindex == 0) && !(Xindex == Board.GetLength(1) - 1 && Yindex == Board.GetLength(0) - 1)) { // Prevent corner pieces from being moved.
                Board[Yindex, Xindex].RotateBlock(Direction, Count);
                if (Count == 1 && !undo) {
                    Phase.IncrementMoveData("BlockRotated");
                    if (Phase.IsReceivingData)
                        Phase.SendMoveData("BlockRotated", string.Format("{0},{1}", Xindex, Yindex), Direction.ToString());
                }
                else if (Count == 2 && Phase.IsReceivingData) {
                    Phase.RemoveLastMove();
                    Phase.SendMoveData("BlockRotated", string.Format("{0},{1}", Xindex, Yindex), Direction.ToString());
                }
                else if (undo) {
                    if (Phase.IsReceivingData)
                        Phase.RemoveLastMove();
                    Phase.IncrementMoveData("BlockRotationUndone");
                }

            }
        }
コード例 #8
0
ファイル: Rotate.cs プロジェクト: BenDy557/TheFall
	public Rotate(Rotate other)
	{
		if (other) {
			degPerSec = other.degPerSec;
		}
	}
コード例 #9
0
    void Awake()
    {
        spectrumData = new float[8192];
        spectrumStorage = new float[108];
        outputData = new float[8192];
        newAngle = 0;
        pxChanger = plane.GetComponent<PixelChanger> ();
        radius=pxChanger.width/7;
        modifyLine = line.GetComponent<ModifyLine> ();
        rightCubes = GameObject.FindGameObjectsWithTag ("SpinMeRight");
        leftCubes = GameObject.FindGameObjectsWithTag ("SpinMeLeft");
        flip = false;
        tracks = GetComponentsInChildren<AudioSource> ();
        currentTrack = 0;
        newTrack = 1;
        audio = tracks [0];
        artifacts = GetComponentsInChildren<TrackArtifacts> ();
        readyTransition = false;
        highestCell = 0;
        tempSpectrumData = 0;
        topFour = new int[4];
        for (int i=0; i<topFour.Length; i++) {
            topFour[i] = 0;
        }
        topFourVals = new float[4];
        for (int i=0; i<topFourVals.Length; i++) {
            topFourVals[i] = 0;
        }
        transObjects = GameObject.FindGameObjectsWithTag ("TransitionButtons");

        for (int i=0; i<transObjects.Length; i++) {
        //			Debug.Log (i + ": " + transObjects[i]);
            if(transObjects[i].name.Equals ("01")){
                transButton01 = transObjects[i].GetComponent<Button>();
            }else if(transObjects[i].name.Equals ("02")){
                transButton02 = transObjects[i].GetComponent<Button>();
            }else if(transObjects[i].name.Equals ("10")){
                transButton10 = transObjects[i].GetComponent<Button>();
            }else if(transObjects[i].name.Equals ("12")){
                transButton12 = transObjects[i].GetComponent<Button>();
            }else if(transObjects[i].name.Equals ("20")){
                transButton20 = transObjects[i].GetComponent<Button>();
            }else if(transObjects[i].name.Equals ("21")){
                transButton21 = transObjects[i].GetComponent<Button>();
            }
        }

        transButton01.interactable = false;
        transButton02.interactable = false;
        transButton10.interactable = false;
        transButton12.interactable = false;
        transButton20.interactable = false;
        transButton21.interactable = false;

        beatBar = GameObject.Find ("Beat Bar").GetComponent<Rotate>();
    }
コード例 #10
0
ファイル: RotateEditor.cs プロジェクト: CaptainKirby/Surtr
    public override void OnInspectorGUI()
    {
        rotate = (Rotate)target;

        //		rotate.transformrotate = EditorGUILayout.ToggleLeft(" Transform rotate", rotate.transformrotate);
        //		if(rotate.transformrotate)
        //		{
        //			SceneView.RepaintAll();
        rotate.playOnAwake = EditorGUILayout.ToggleLeft("Play on awake", rotate.playOnAwake);
            rotate.pauseable = EditorGUILayout.ToggleLeft("Pauseable", rotate.pauseable);
            //			rotate.resetrotate = EditorGUILayout.ToggleLeft(" Reset", rotate.resetrotate);
            rotate.pingPongRotate = EditorGUILayout.ToggleLeft(" Ping Pong", rotate.pingPongRotate);
            rotate.smoothRotate= EditorGUILayout.ToggleLeft(" Smooth rotate", rotate.smoothRotate);
            rotate.rotateStartDelay = EditorGUILayout.ToggleLeft(" Start Delay", rotate.rotateStartDelay);
            if(rotate.rotateStartDelay)
            {
                rotate.rotateStartDelayTime = EditorGUILayout.FloatField("Start Delay Duration: ", rotate.rotateStartDelayTime);
            }
            rotate.rotateInbetweenDelay= EditorGUILayout.ToggleLeft(" Inbetween Delay ", rotate.rotateInbetweenDelay);
            if(rotate.rotateInbetweenDelay)
            {
                rotate.rotateInbetweenDelayTime = EditorGUILayout.FloatField("Inbetween Delay Duration: ", rotate.rotateInbetweenDelayTime);
            }
            rotate.rotateSpeed = EditorGUILayout.FloatField("rotate Speed: ", rotate.rotateSpeed);

            EditorGUILayout.Vector3Field("Start from vector3:", rotate.rotateStartAngle);

            EditorGUILayout.Vector3Field("rotate to vector3:", rotate.rotateToAngle);

            Rect r = EditorGUILayout.BeginVertical();

            if(GUI.Button(new Rect(r.x, r.y, 120,15),"Set start rotation"))
            {
                rotate.rotateStartAngle = rotate.gameObject.transform.rotation.eulerAngles;
            }
            if(GUI.Button(new Rect(r.x + 125, r.y, 150,15),"rotate to start rotation"))
            {
                rotate.gameObject.transform.rotation = Quaternion.Euler(rotate.rotateStartAngle);
            }
            if(GUI.Button(new Rect(r.x + 280, r.y, 50,15),"Reset"))
            {
                rotate.rotateStartAngle = new Vector3(0,0,0);
            }

            EditorGUILayout.Space();
            EditorGUILayout.Space();
            EditorGUILayout.EndVertical();

            EditorGUILayout.Space();

            Rect r2 = EditorGUILayout.BeginVertical();

            if(GUI.Button(new Rect(r2.x, r2.y, 120,15),"Set end rotation"))
            {
                rotate.rotateToAngle = rotate.gameObject.transform.rotation.eulerAngles;
            }
            if(GUI.Button(new Rect(r2.x + 125, r2.y, 150,15),"rotate to end rotation"))
            {
                rotate.gameObject.transform.rotation = Quaternion.Euler(rotate.rotateToAngle);
            }
            if(GUI.Button(new Rect(r2.x + 280, r2.y, 50,15),"Reset"))
            {
                rotate.rotateToAngle = new Vector3(0,0,0);
            }

            EditorGUILayout.Space();
            EditorGUILayout.Space();
            EditorGUILayout.EndVertical();

            EditorGUILayout.Space();
            GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));
            EditorGUILayout.Space();

        //		}
    }
コード例 #11
0
 private void Start()
 {
     rotate = Rotate.right;
     InvokeRepeating("ChangeDirection", 5f, 10f);  //1s delay, repeat every 1s
 }
コード例 #12
0
ファイル: Rotation.cs プロジェクト: pierre-ecarlat/graph5D
 public void SetToNone()
 {
     type = Rotate.None;
 }
コード例 #13
0
ファイル: Rotation.cs プロジェクト: pierre-ecarlat/graph5D
 public void SetToNext()
 {
     type = Rotate.Next;
 }
コード例 #14
0
ファイル: Rotation.cs プロジェクト: pierre-ecarlat/graph5D
 // Setters
 public void SetToPrev()
 {
     type = Rotate.Prev;
 }
コード例 #15
0
        public virtual IEnumerator <ccr.ITask> RotateHandler(Rotate message)
        {
            RotateMessageHandler handler = new RotateMessageHandler(this, Environment.TaskQueue);

            return(handler.RunHandler(message.Body, message.ResponsePort));
        }
コード例 #16
0
        /// <summary>
        /// Se realiza:
        /// <para>1. Se posiciona la marca de agua de acuerdo a los <see cref="TissotIndicatrix"/> (Top, Bottom y del 1 - 8)</para>
        /// <para>2. Se realiza la deformación <see cref="Fisheye.Convert(FisheyeBitmap)"/></para>
        /// <para>3. Se realiza la deformación <see cref="Fisheye.ToLandscape(FisheyeBitmap)"/></para>
        /// <para>4. Se posiciona la marca de agua de acuerdo a los <see cref="TissotIndicatrix"/> de la posición del centro (9 - 12)</para>
        /// </summary>
        public void Prepare()
        {
            int            size = 0;
            AbstractBitmap img  = null;

            foreach (var indicatrix in _indicatrixes.Where(i => i.Position != Position.Center))
            {
                // Se conserva la relacion aspecto de acuerdo al ancho de la imagen

                if (_imageWatermark.Width > _imageWatermark.Height)
                {
                    size = (indicatrix.MaxWidth * _imageWatermark.Height) / _imageWatermark.Width;

                    img = Resize.Apply(_imageWatermark, indicatrix.MaxWidth, size);
                }
                else
                {
                    size = (indicatrix.MaxHeight * _imageWatermark.Width) / _imageWatermark.Height;

                    img = Resize.Apply(_imageWatermark, size, indicatrix.MaxHeight);
                }

                img = Rotate.Apply(img, indicatrix.Angle);

                var posX = indicatrix.X - (img.Width / 2);
                var posY = indicatrix.Y - (img.Height / 2);

                if (indicatrix.Position == Position.Top)
                {
                    this._topFisheye.InsertImageUnmanaged(img, posX, posY);
                }
                else
                {
                    img._image.RotateFlip(RotateFlipType.RotateNoneFlipXY);

                    this._bottomFisheye.InsertImageUnmanaged(img, posX, posY);
                }
            }

            // Se realiza la deformación fisheye

            var feTop    = Fisheye.Convert(this._topFisheye);
            var feBottom = Fisheye.Convert(this._bottomFisheye);

            // Se deforman los fisheye a landscape

            feBottom = Fisheye.ToLandscape(feBottom);

            feTop = Fisheye.ToLandscape(feTop);
            feTop._image.RotateFlip(RotateFlipType.RotateNoneFlipXY);

            // Se insertan en el bitmap "watermak"

            _waterMark.InsertImageUnmanaged(feTop, 0, 0);
            _waterMark.InsertImageUnmanaged(feBottom, 0, feBottom.Height);

            // Se insertan aquellos indicatrix que pertenezcan al centro de la imagen

            foreach (var indicatrix in _indicatrixes.Where(i => i.Position == Position.Center))
            {
                if (_imageWatermark.Width > _imageWatermark.Height)
                {
                    size = (indicatrix.MaxWidth * _imageWatermark.Height) / _imageWatermark.Width;

                    img = Resize.Apply(_imageWatermark, indicatrix.MaxWidth, size) as WatermarkBitmap;
                }
                else
                {
                    size = (indicatrix.MaxHeight * _imageWatermark.Width) / _imageWatermark.Height;

                    img = Resize.Apply(_imageWatermark, size, indicatrix.MaxHeight) as WatermarkBitmap;
                }

                _waterMark.InsertImageUnmanaged(img, indicatrix.X - img.Width / 2, indicatrix.Y - img.Height / 2);
            }

            //_waterMark.Save(@"C:\Users\Euler\Pictures\WMpreared2.png", ImageFormat.Png);
        }
コード例 #17
0
 public void Post(Rotate msg)
 {
     base.PostUnknownType(msg);
 }
コード例 #18
0
ファイル: Network.cs プロジェクト: kcm1700/Getris
 //2byte를 보낸다는 의미로 2를 보내고
 //left면 1, right면 0
 //cw 면 1, ccw면 0
 //이렇게 하기 위해서 rotate의 data를 단순히 cw, ccw로 하는게 아니라 left:cw, left:ccw, right:cw, right:ccw로 해야 할듯.
 //하지만 left, right정보는 network와 display game에서만 필요하니 RunGame에서는 쓰던대로 cw, ccw만 써도 될듯.
 public bool Send(Rotate action)
 {
     byte[] message = new byte[3];
     string[] user_rot = action.data.Split(':');
     if (user_rot.Length != 2)
         return false;
     message[0] = 2;
     message[1] = Convert.ToByte(user_rot[0] == "left");
     message[2] = Convert.ToByte(user_rot[1] == "cw");
     return Send(message);
 }
コード例 #19
0
        public void updateTransform(Transform trans)
        {
            mPivotX = length * pivotX;
            mPivotY = height * pivotY;

            // update //////////////////////////////////////////////////////////////////////////////////
            p = shape.draw(length, pathSizeModifier, pathAngle + (pathAngleModifier), 0);
            //p = Circle.draw3D(length, pathSizeModifier, pathAngle + (pathAngleModifier), 0);

            p = Rotate.rotate(p, (pathRotation + shape.getPathRotation()));

            x = p.x + xAdjBase + (xAdj); // - mPivotX;
            y = p.y + yAdjBase + (yAdj); // - mPivotY - (height / 2);
            z = p.z + zAdjBase + (zAdj);

            prevRotate   = rotateAmount;
            rotateAmount = Point.toDegrees(propAngle + propAngleModifier);
            // end of update ///////////////////////////////////////////////////////////////////////////

            if (flip3D)
            {
                trans.RotateAround(new Vector3((float)x, 0f, (float)y), Vector3.up, (float)(rotateAmount - prevRotate));
            }
            if (twist3D)
            {
                trans.RotateAround(new Vector3(0f, (float)x, (float)y), Vector3.right, (float)(rotateAmount - prevRotate));
            }
            trans.RotateAround(new Vector3((float)x, (float)y, (float)z), Vector3.back, (float)(rotateAmount - prevRotate));
            //trans.RotateAround(new Vector3(0f, 0f, (float)z), Vector3.up, (float)Math.Cos(rotateAmount - prevRotate));
            //trans.RotateAround(new Vector3(0f, 0f, (float)z), Vector3.right, (float)Math.Sin(rotateAmount - prevRotate));

            if (use3D && flip3D)
            {
                trans.SetPositionAndRotation(new Vector3((float)x, 0f, (float)y), trans.rotation);
            }
            else if (use3D && twist3D)
            {
                trans.SetPositionAndRotation(new Vector3(0f, (float)x, (float)y), trans.rotation);
            }
            else
            {
                trans.SetPositionAndRotation(new Vector3((float)x, (float)y, (float)z), trans.rotation);
            }
            // gotta change this for PivotPoint

            double velocity = accelerationChange.updateAngle(propAngle, propAngleIncrement, propSpeed, propDirection);
            double speed    = 0; //speedControl.updateAngle(continuousPathAngleNoChange, propAngle, propAngleIncrement, propSpeed, propDirection, speedChangeModifier);

            propDirection = directionChange.updateAngle(continuousPropAngleNoChange, continuousPropDirection, directionChangeModifier);

            ////////////////////////////////////////////////////////////////////////////////////////
            // Real update to angle.
            ////////////////////////////////////////////////////////////////////////////////////////////

            propAngle += ((((propAngleIncrement) * propSpeed) + (velocity / slowMotionConstant)) * propDirection) + speed;
            if (usePendulums)
            {
                pathAngle += (((pathAngleIncrement) * pathSpeed) + (velocity / slowMotionConstant)) * pathDirection;
            }
            else
            {
                pathAngle += (((pathAngleIncrement) * pathSpeed) + (Math.Abs(velocity) / slowMotionConstant)) * pathDirection;
            }

            ////////////////////////////////////////////////////////////////////////////////////////

            continuousPropAngle += (((propAngleIncrement) * propSpeed)) * propDirection;
            continuousPathAngle += (((pathAngleIncrement) * pathSpeed)) * pathDirection;

            ////////////////////////////////////////////////////////////////////////////////////////

            continuousPropAngleNoChange += (((propAngleIncrement) * propSpeed));
            continuousPathAngleNoChange += (((pathAngleIncrement) * pathSpeed));

            //return trans;
        }
コード例 #20
0
 /// <summary>
 /// Initializes a new instance of the Ht16K33 I2C controller as found on the Adafriut Mini LED Matrix.
 /// </summary>
 /// <param name="frame">On or Off - defaults to On</param>
 /// <param name="brightness">Between 0 and 15</param>
 /// <param name="blinkrate">Defaults to Off.  Blink rates Fast = 2hz, Medium = 1hz, slow = 0.5hz</param>
 public Ht16K33BiColor(byte[] I2CAddress, Rotate rotate = Rotate.None, Display frame = LedDriver.Display.On, byte brightness = 0, BlinkRate blinkrate = BlinkRate.Off, string I2cControllerName="I2C1")
     : base(I2CAddress, rotate, frame, brightness, blinkrate, I2cControllerName) { }
コード例 #21
0
        public static bool Prefix(Map map)
        {
            //if (!DefsUtil.Enable)
            //    return true;
            //if (!DefsUtil.EnableMountainSettings)
            //    return true;
            if (Settings.detectedImpassableMaps && map.TileInfo.hilliness == Hilliness.Impassable)
            {
                return(true);
            }

            NoiseRenderer.renderSize = new IntVec2(map.Size.x, map.Size.z);
            ModuleBase input = new Perlin(0.020999999716877937, 2.0, 0.5, 6, Rand.Range(0, int.MaxValue), QualityMode.High);

            input = new ScaleBias(0.5, 0.5, input);
            NoiseDebugUI.StoreNoiseRender(input, "elev base");
            float num = 1f;

            switch (map.TileInfo.hilliness)
            {
            case Hilliness.Flat:
                num = MapGenTuning.ElevationFactorFlat;
                break;

            case Hilliness.SmallHills:
                num = MapGenTuning.ElevationFactorSmallHills;
                break;

            case Hilliness.LargeHills:
                num = MapGenTuning.ElevationFactorLargeHills;
                break;

            case Hilliness.Mountainous:
                num = MapGenTuning.ElevationFactorMountains;
                break;

            case Hilliness.Impassable:
                num = MapGenTuning.ElevationFactorImpassableMountains;
                break;
            }
            input = new Multiply(input, new Const(num + MapSettings.Mountain.GetMultiplier()));
            NoiseDebugUI.StoreNoiseRender(input, "elev world-factored");
            if (map.TileInfo.hilliness == Hilliness.Mountainous || map.TileInfo.hilliness == Hilliness.Impassable)
            {
                ModuleBase input2 = new DistFromAxis((float)map.Size.x * 0.42f);
                input2 = new Clamp(0.0, 1.0, input2);
                input2 = new Invert(input2);
                input2 = new ScaleBias(1.0, 1.0, input2);
                Rot4 random;
                do
                {
                    random = Rot4.Random;
                }while (random == Find.World.CoastDirectionAt(map.Tile));
                if (random == Rot4.North)
                {
                    input2 = new Rotate(0.0, 90.0, 0.0, input2);
                    input2 = new Translate(0.0, 0.0, -map.Size.z, input2);
                }
                else if (random == Rot4.East)
                {
                    input2 = new Translate(-map.Size.x, 0.0, 0.0, input2);
                }
                else if (random == Rot4.South)
                {
                    input2 = new Rotate(0.0, 90.0, 0.0, input2);
                }
                else
                {
                    _ = random == Rot4.West;
                }
                NoiseDebugUI.StoreNoiseRender(input2, "mountain");
                input = new Add(input, input2);
                NoiseDebugUI.StoreNoiseRender(input, "elev + mountain");
            }
            float           b         = (map.TileInfo.WaterCovered ? 0f : float.MaxValue);
            MapGenFloatGrid elevation = MapGenerator.Elevation;

            foreach (IntVec3 allCell in map.AllCells)
            {
                elevation[allCell] = Mathf.Min(input.GetValue(allCell), b);
            }
            ModuleBase input3 = new Perlin(0.020999999716877937, 2.0, 0.5, 6, Rand.Range(0, int.MaxValue), QualityMode.High);

            input3 = new ScaleBias(0.5, 0.5, input3);
            NoiseDebugUI.StoreNoiseRender(input3, "noiseFert base");
            MapGenFloatGrid fertility = MapGenerator.Fertility;

            foreach (IntVec3 allCell2 in map.AllCells)
            {
                fertility[allCell2] = input3.GetValue(allCell2);
            }
            return(false);
        }
コード例 #22
0
        public CustomBlockData CreateUVsRotated(Rotate rotate)
        {
            switch (rotate)
            {
                case Rotate.None:
                    return CreateUVs();
                case Rotate.Deg90:
                    return CreateUVsRotated(90);
                case Rotate.Deg180:
                    return CreateUVsRotated(180);
                case Rotate.Deg270:
                    return CreateUVsRotated(270);
            }

            return this.CreateUVs();
        }
コード例 #23
0
 public BuilderRotate(Rotate rotate)
 {
     x = new Dimension(rotate.angle.value, StyleSheetUtilities.ConvertToDimensionUnit(rotate.angle.unit));
 }
コード例 #24
0
ファイル: Rotate.cs プロジェクト: BenDy557/TheFall
	public void CopyRotate(Rotate other)
	{
		if (other) {
			degPerSec = other.degPerSec;
		}
	}
コード例 #25
0
 /// <summary>
 /// Initializes a new instance of the Ht16K33 I2C controller as found on the Adafriut Mini LED Matrix.
 /// </summary>
 /// <param name="frame">On or Off - defaults to On</param>
 /// <param name="brightness">Between 0 and 15</param>
 /// <param name="blinkrate">Defaults to Off.  Blink rates Fast = 2hz, Medium = 1hz, slow = 0.5hz</param>
 public Ht16K33BiColor(byte[] I2CAddress, Rotate rotate = Rotate.None, Display frame = LedDriver.Display.On, byte brightness = 0, BlinkRate blinkrate = BlinkRate.Off, string I2cControllerName = "I2C1")
     : base(I2CAddress, rotate, frame, brightness, blinkrate, I2cControllerName)
 {
 }
コード例 #26
0
ファイル: IncantationPosing.cs プロジェクト: PeWiNi/theDude
 // Use this for initialization
 void Start()
 {
     character = GameObject.Find("hero").GetComponentInChildren<Rotate>();
     canvas = transform.GetComponent<Canvas>();
     incantiees = GameObject.Find("envChanger").GetComponentInChildren<incantations>();
 }
コード例 #27
0
ファイル: Form1.cs プロジェクト: G07cha/Tetris
        void GetRandomBlock()
        {
            int RandomPosition = rand.Next(0, 4);

            switch (RandomBlock)
            {
                case 0:
                    t_block = new T_Block(StartPoint, RandomPosition, BlockSize,board);
                    moveLeft = t_block.MoveLeft;
                    moveRight = t_block.MoveRight;
                    moveDown = t_block.MoveDown;
                    rotate = t_block.Rotate;

                    BlockColor = t_block.color;
                    returnCoordinates = t_block.returnCoordinates;

                    break;
                case 1:
                    square = new Square(StartPoint, BlockSize,board);
                    moveLeft = square.MoveLeft;
                    moveRight = square.MoveRight;
                    moveDown = square.MoveDown;
                    rotate = square.Rotate;

                    BlockColor = square.color;
                    returnCoordinates = square.returnCoordinates;

                    break;
                case 2:
                    stick = new Stick(StartPoint, RandomPosition, BlockSize,board);
                    moveLeft = stick.MoveLeft;
                    moveRight = stick.MoveRight;
                    moveDown = stick.MoveDown;
                    rotate = stick.Rotate;

                    BlockColor = stick.color;
                    returnCoordinates = stick.returnCoordinates;

                    break;
                case 3:
                    z_block = new Z_Block(StartPoint, RandomPosition, BlockSize,board);
                    moveLeft = z_block.MoveLeft;
                    moveRight = z_block.MoveRight;
                    moveDown = z_block.MoveDown;
                    rotate = z_block.Rotate;

                    BlockColor = z_block.color;
                    returnCoordinates = z_block.returnCoordinates;
                    break;
                //
                default:
                    break;

            }
        }
コード例 #28
0
 // Use this for initialization
 void Start()
 {
     GameObject r = GameObject.Find ("Switch");
     r1 = r.GetComponent<Rotate> ();
 }
コード例 #29
0
    private void CameraControls()
    {
        if (mRotate != Rotate.Stop)
            return;

        if (Input.GetKeyDown(KeyCode.Q))
        {
            mPreviousCardinalPosition = mCardinalPosition;
            mRotate = Rotate.Left;
            mCardinalPosition = SetNextCardinalPoint(mCardinalPosition, mRotate);
            nextRotation.y += 90;
        }
        if (Input.GetKeyDown(KeyCode.E))
        {
            mPreviousCardinalPosition = mCardinalPosition;
            mRotate = Rotate.Right;
            mCardinalPosition = SetNextCardinalPoint(mCardinalPosition, mRotate);
            nextRotation.y -= 90;
        }
    }
コード例 #30
0
        /// <summary>
        /// Rotates an image by the given angle in degrees.
        /// </summary>
        /// <param name="source">The image to resize.</param>
        /// <param name="degrees">The angle in degrees to perform the rotation.</param>
        /// <param name="sampler">The <see cref="IResampler"/> to perform the resampling.</param>
        /// <param name="progressHandler">A delegate which is called as progress is made processing the image.</param>
        /// <returns>The <see cref="Image"/></returns>
        public static Image Rotate(this Image source, float degrees, IResampler sampler, ProgressEventHandler progressHandler = null)
        {
            Rotate processor = new Rotate(sampler) { Angle = degrees };
            processor.OnProgress += progressHandler;

            try
            {
                return source.Process(source.Width, source.Height, source.Bounds, source.Bounds, processor);
            }
            finally
            {
                processor.OnProgress -= progressHandler;
            }
        }
コード例 #31
0
    private CardinalPosition SetNextCardinalPoint(CardinalPosition cardinalPoint, Rotate direction)
    {

        CardinalPosition newCardinal = CardinalPosition.North;

        if(direction == Rotate.Left)
        {
            switch (cardinalPoint)
            {
                case CardinalPosition.North:
                    newCardinal = CardinalPosition.East;
                    break;
                case CardinalPosition.East:
                    newCardinal = CardinalPosition.South;
                    break;
                case CardinalPosition.South:
                    newCardinal = CardinalPosition.West;
                    break;
                case CardinalPosition.West:
                    newCardinal = CardinalPosition.North;
                    break;
            }
        }

        else if(direction == Rotate.Right)
        {
            switch (cardinalPoint)
            {
                case CardinalPosition.North:
                    newCardinal = CardinalPosition.West;
                    break;
                case CardinalPosition.East:
                    newCardinal = CardinalPosition.North;
                    break;
                case CardinalPosition.South:
                    newCardinal = CardinalPosition.East;
                    break;
                case CardinalPosition.West:
                    newCardinal = CardinalPosition.South;
                    break;
            }
        }
        return newCardinal;
    }
コード例 #32
0
ファイル: Processor.cs プロジェクト: PhotoVision/CCWireframe
        public static void ProcessImage(IProcessorItem item)
        {
            using (ImageReader reader = ImageReader.Create(item.Source))
            using (var contrast = new Contrast(item.Correction.Contrast))
            using (var levels = new Levels(item.Correction.Black, item.Correction.White, item.Correction.Shadow, item.Correction.Midpoint, item.Correction.Highlight, HistogramMode.Luminosity))
            using (var color = new ChannelBalance())
            using (var rotate = new Rotate(item.Correction.Rotate))
            using (var saturation = new AdjustHsl(0f, item.Correction.Saturation, 0f))
            using (var writer = new JpegWriter(Path.ChangeExtension(item.Destination, "jpg"), 99))
            {
                color.Addends = new float[3]
                {
                    item.Correction.Blue,
                    item.Correction.Green,
                    item.Correction.Red
                };
                color.Multipliers = new float[3]
                {
                    1f,
                    1f,
                    1f
                };

                writer.UseSubsampling = false;

                Pipeline.Run(reader + contrast + levels + color + rotate + saturation + writer);
            }
        }
コード例 #33
0
ファイル: Box.cs プロジェクト: lalanikarim/agg-sharp
        /// <summary>
        /// Cun along the diagonal of a give edge to the opposite edge.  The edge is chosen by saying
        /// which 2 faces are to be kept solid, and or-ing them together.
        /// </summary>
        /// <param name="facesThatShareEdge">The two faces to maintain after the cut, or-ed together with '|'.</param>
        public void CutAlongDiagonal(Face facesToKeepWhole)
        {
            switch (facesToKeepWhole)
            {
            case (Face.Left | Face.Back):
            {
                Vector3   size        = root.Size;
                CsgObject boxToCutOut = new Box(Math.Sqrt(2), 1, 1.1, createCentered: false);
                boxToCutOut = new Rotate(boxToCutOut, new Vector3(0, 0, MathHelper.Tau / 8));
                boxToCutOut = new Translate(boxToCutOut, x: Math.Sqrt(2) / 2, y: -Math.Sqrt(2) / 2, z: -.05);
                boxToCutOut = new Scale(boxToCutOut, size, name: "boxToCutOut");
                root        = new Difference(root, boxToCutOut);
            }
            break;

            case (Face.Left | Face.Front):
            {
                Vector3   size        = root.Size;
                CsgObject boxToCutOut = new Box(Math.Sqrt(2), 1, 1.1, createCentered: false);
                boxToCutOut = new Rotate(boxToCutOut, new Vector3(0, 0, -MathHelper.Tau / 8));
                boxToCutOut = new Translate(boxToCutOut, y: 1, z: -.05);
                boxToCutOut = new Scale(boxToCutOut, size, name: "boxToCutOutLeftFront");
                root        = new Difference(root, boxToCutOut);
            }
            break;

            case (Face.Left | Face.Bottom):
            {
                Vector3   size        = root.Size;
                CsgObject boxToCutOut = new Box(Math.Sqrt(2), 1.1, 1, createCentered: false);
                boxToCutOut = new Rotate(boxToCutOut, new Vector3(0, MathHelper.Tau / 8, 0));
                boxToCutOut = new Translate(boxToCutOut, y: -.05, z: 1);
                boxToCutOut = new Scale(boxToCutOut, size, name: "boxToCutOut");
                root        = new Difference(root, boxToCutOut);
            }
            break;

            case (Face.Right | Face.Front):
            {
                Vector3   size        = root.Size;
                CsgObject boxToCutOut = new Box(Math.Sqrt(2), 1, 1.1, createCentered: false, name: "boxtToCutOut");
                boxToCutOut = new Rotate(boxToCutOut, new Vector3(0, 0, MathHelper.Tau / 8));
                boxToCutOut = new Translate(boxToCutOut, z: -.05);
                boxToCutOut = new Scale(boxToCutOut, size, name: "boxToCutOutRightFront");
                root        = new Difference(root, boxToCutOut);
            }
            break;

            case (Face.Right | Face.Bottom):
            {
                Vector3   size        = root.Size;
                CsgObject boxToCutOut = new Box(Math.Sqrt(2), 1.1, 1, createCentered: false, name: "boxToCutOut");
                boxToCutOut = new Rotate(boxToCutOut, new Vector3(0, -MathHelper.Tau / 8, 0));
                boxToCutOut = new Translate(boxToCutOut, 0, -.05, 0);
                //boxToCutOut = new Translate(boxToCutOut, Math.Sqrt(2) / 2, 0, -Math.Sqrt(2) / 2);
                boxToCutOut = new Scale(boxToCutOut, size, name: "boxToCutOut");
                root        = new Difference(root, boxToCutOut);
            }
            break;

            case (Face.Right | Face.Top):
            {
                Vector3   size        = root.Size;
                CsgObject boxToCutOut = new Box(Math.Sqrt(2), 1.1, 1, createCentered: false, name: "boxToCutOut");
                boxToCutOut = new Rotate(boxToCutOut, new Vector3(0, MathHelper.Tau / 8, 0));
                boxToCutOut = new Translate(boxToCutOut, -Math.Sqrt(2) / 2, 0, 1 - Math.Sqrt(2) / 2);
                boxToCutOut = new Scale(boxToCutOut, size, name: "botToCutOut");
                root        = new Difference(root, boxToCutOut);
            }
            break;

            case (Face.Front | Face.Top):
            {
                Vector3   size        = root.Size;
                CsgObject boxToCutOut = new Box(1.1, Math.Sqrt(2), 1, createCentered: false, name: "boxToCutOut");
                boxToCutOut = new Rotate(boxToCutOut, new Vector3(MathHelper.Tau / 8, 0, 0));
                boxToCutOut = new Translate(boxToCutOut, -.05, Math.Sqrt(2) / 2, -Math.Sqrt(2) / 2);
                boxToCutOut = new Scale(boxToCutOut, size);
                root        = new Difference(root, boxToCutOut);
            }
            break;

            case (Face.Front | Face.Bottom):
            {
                Vector3   size        = root.Size;
                CsgObject boxToCutOut = new Box(1.1, Math.Sqrt(2), 1, createCentered: false, name: "boxToCutOut");
                boxToCutOut = new Rotate(boxToCutOut, new Vector3(-MathHelper.Tau / 8, 0, 0));
                boxToCutOut = new Translate(boxToCutOut, -.05, 0, 1);
                boxToCutOut = new Scale(boxToCutOut, size, name: "boxtToCutOutFrontBottom");
                root        = new Difference(root, boxToCutOut);
            }
            break;

            case (Face.Bottom | Face.Back):
            {
                Vector3   size        = root.Size;
                CsgObject boxToCutOut = new Box(1.1, Math.Sqrt(2), 1, createCentered: false);
                boxToCutOut = new Rotate(boxToCutOut, new Vector3(MathHelper.Tau / 8, 0, 0));
                boxToCutOut = new Translate(boxToCutOut, x: -.05);
                boxToCutOut = new Scale(boxToCutOut, size, name: "boxToCutOut");
                root        = new Difference(root, boxToCutOut);
            }
            break;

            case (Face.Back | Face.Top):
            {
                Vector3   size        = root.Size;
                CsgObject boxToCutOut = new Box(1.1, Math.Sqrt(2), 1, createCentered: false, name: "boxToCutOut");
                boxToCutOut = new Rotate(boxToCutOut, new Vector3(-MathHelper.Tau / 8, 0, 0));
                boxToCutOut = new Translate(boxToCutOut, x: -.05, y: -Math.Sqrt(2) / 2, z: .28);                                 // TODO: do the right math. .28 is hacky
                boxToCutOut = new Scale(boxToCutOut, size, name: "boxToCutOut");
                root        = new Difference(root, boxToCutOut);
            }
            break;

            default:
                throw new NotImplementedException("Just write it for this case.");
            }
        }