/// <summary> /// /// </summary> /// <param name="light">ライト</param> /// <param name="observableStatus">ステータスの変更通知</param> /// <param name="circleCenterPoint">回転照射する際の回転中心座標</param> /// <param name="radius">回転照射する際の回転半径</param> /// <param name="lr">右のライトか左のライトか</param> public SlotLightLookAtChanger(UnityEngine.Light light, IObservable <SlotProductionStatus> observableStatus, Vector3 circleCenterPoint, float radius, LeftRight lr) { //初期照射座標をセット light.transform.LookAt(circleCenterPoint); //ライトの照射座標を回転移動させるシーケンス Tween tween = DOTween.To(AnglePlugin.Instance, () => nowIrradiationAngle, angle => { nowIrradiationAngle = angle; light.transform.LookAt(circleRadius * angle.Point.AddZ() + this.circleCenterPoint); }, lr == LeftRight.Left ? Angle.Round : -Angle.Round, 1f) .SetRelative() .SetEase(Ease.Linear) .SetLoops(-1) .OnPause(() => light.transform.LookAt(circleCenterPoint)); this.circleCenterPoint = circleCenterPoint; this.circleRadius = radius; //リーチと当たったときだけ、ライトの照射先を回転させる lookAtSequenceTable = new Dictionary <SlotProductionStatus, Action>() { [SlotProductionStatus.Idol] = () => tween.Pause(), [SlotProductionStatus.Rolling] = () => tween.Pause(), [SlotProductionStatus.Reaching] = () => tween.Play(), [SlotProductionStatus.Winning] = () => tween.Play(), }; observableStatus.Select(s => lookAtSequenceTable[s]) .Subscribe(act => act()); }
private static string Rotate(string input, LeftRight side, int steps) { var buffer = input.ToCharArray(); for (int step = 0; step < steps; step++) { char tmp; switch (side) { case LeftRight.Right: tmp = buffer[buffer.Length - 1]; for (int i = buffer.Length - 1; i >= 1; i--) { buffer[i] = buffer[i - 1]; } buffer[0] = tmp; break; case LeftRight.Left: tmp = buffer[0]; for (int i = 0; i < buffer.Length - 1; i++) { buffer[i] = buffer[i + 1]; } buffer[buffer.Length - 1] = tmp; break; default: throw new ArgumentOutOfRangeException(nameof(side), side, null); } } return(new string(buffer)); }
/// <summary> /// Method to create a tree with one child /// </summary> public static BifiTree GetBifiTree(string _label, BifiTree _child, decimal _branch, LeftRight _leftRight) { BifiTree treeReturn = new BifiTree(_label); if (_leftRight == LeftRight.Left) { treeReturn.SetLeft(_child, _branch); } else { treeReturn.SetRight(_child, _branch); } return(treeReturn); }
public LeftRightList() { m_leftRight = new LeftRight <List <int> >(() => new List <int>()); }
/// <summary> /// Check if the player click any key /// </summary> /// <param name="ElapsedTime"></param> public void ClickedKeys(double ElapsedTime) { //Prevent player from fast clicking FrameTimer += (float)ElapsedTime; if (FrameTimer >= 0.1f) { FrameTimer -= 0.1f; if (Grid.GameOn()) { if (Engine.KeyClicked(System.Windows.Forms.Keys.Down)) { UpDown.Play(false); Grid.MoveDown(); } if (Engine.KeyClicked(System.Windows.Forms.Keys.Up)) { UpDown.Play(false); Grid.MoveUp(); } if (Engine.KeyClicked(System.Windows.Forms.Keys.Left)) { LeftRight.Play(false); Grid.MoveLeft(); } if (Engine.KeyClicked(System.Windows.Forms.Keys.Right)) { LeftRight.Play(false); Grid.MoveRight(); } } if (Engine.KeyClicked(System.Windows.Forms.Keys.Space)) { if (BackgroundMusic.IsBeingPlayed) { BackgroundMusic.StopPlaying(); } else { BackgroundMusic.Play(true); } } if (!Grid.GameOn()) { if (Engine.KeyClicked(System.Windows.Forms.Keys.Enter)) { Score = new Score(this.Engine, Grid.Score); Engine.RegisterScene(Score); Engine.GoToScene(Score); } } } //Go back to the menu if (Engine.KeyClicked(System.Windows.Forms.Keys.Escape)) { Menu menu = new Menu(Engine, this); Engine.GoToScene(menu); } }
public Side(LeftRight side) { this.side = side; }
private void MakeMove(object source, ElapsedEventArgs e) { //checking for correct x of ball to contact with the first player if (ball.X >= (firstPlayer.X + firstPlayer.Width) && ball.X <= (firstPlayer.X + firstPlayer.Width + ball.BallSpeedSide)) { //checking for correct y of ball to contact with the first player if ((ball.Y > firstPlayer.Y && firstPlayer.Y + firstPlayer.Heigth > ball.Y) || (ball.Y < firstPlayer.Y && firstPlayer.Y < ball.Y + ball.WidthHeight)) { leftRight = LeftRight.Right; } } //check if first player missed the ball if (ball.X <= 0) { secondPlayer.Score += 1; form.Invoke(Scored); } //checking for correct x of ball to contact with the second player if (ball.X + ball.WidthHeight <= secondPlayer.X && ball.X + ball.WidthHeight + ball.BallSpeedSide >= secondPlayer.X) { //checking for correct y of ball to contact with the second player if ((ball.Y < secondPlayer.Y + secondPlayer.Heigth && ball.Y > secondPlayer.Y) || (ball.Y < secondPlayer.Y && ball.Y + ball.WidthHeight > secondPlayer.Y)) { leftRight = LeftRight.Left; } } //check if second player missed the ball if (ball.X + ball.WidthHeight >= form.ClientSize.Width) { firstPlayer.Score += 1; form.Invoke(Scored); } //checking if the ball hitted bottom edge if (ball.Y + ball.WidthHeight <= form.ClientSize.Height && ball.Y + ball.WidthHeight + ball.BallSpeedHeight >= form.ClientSize.Height) { upDown = UpDown.Up; } if (ball.Y >= 0 && ball.Y - ball.BallSpeedHeight < 0) { upDown = UpDown.Down; } if (leftRight == LeftRight.Left) { ball.X -= ball.BallSpeedSide; } else { ball.X += ball.BallSpeedSide; } if (upDown == UpDown.Up) { ball.Y -= ball.BallSpeedHeight; } else { ball.Y += ball.BallSpeedHeight; } try { form.Invoke(Refresh); } catch { } }
void EnqueNode(PointInfo info, int i, LeftRight type) { PointInfo aux; aux = new PointInfo(); aux.leftRight = type; aux.angl = info.angl; aux.refPoint = info.refPoint; aux.orgSweep = info.orgSweep; if (type == LeftRight.LEFT) aux.sweep = info.sweep - 0.1; else aux.sweep = info.sweep + 0.1; if (aux.sweep > 2 * aux.orgSweep) aux.sweep -= 0.1; if (aux.sweep < 0) aux.sweep += 0.1; aux.point = CalcPoint(aux.refPoint, aux.angl, aux.sweep, r - 20); qp[i].Enqueue(aux); }
/* private void Update() * { * Debug.Log("Stop active:" + stopSignActive); * }*/ private void OnTriggerEnter(Collider other) { //Debug.Log(transform.name + " var: " + var.ToString()); if (transform.name == "ColliderFirst") { var.x.flag1 = true; var.x.isWrongWay(); } if (transform.name == "ColliderSecond") { var.x.flag2 = true; var.x.isWrongWay(); } if (transform.name == "ColliderStop") { StopSign.stopSignActive = true; Debug.Log("Usao u stop"); Instance.stop.CheckStop(transform); //Timer(3); } if (transform.name == "ColliderUp") { UP.isActive = true; Debug.Log("Usao u UP"); } if (transform.name == "ColliderLeft&Up") { LeftUp.isActive = true; Debug.Log("Usao u Left&UP"); } if (transform.name == "ColliderLeft") { LeftSign.isActive = true; Debug.Log("Left"); } if (transform.name == "ColliderRight") { RightSign.isActive = true; Debug.Log("Right"); } if (transform.name == "ColliderRight&Up") { RightUp.isActive = true; Debug.Log("RightUP"); } if (transform.name == "ColliderBoth") { LeftRight.isActive = true; Debug.Log("Left & Right"); } if (transform.name == "ColliderWrongWay") { Debug.Log("Krivi smjer!"); } if (transform.GetComponentInParent <IntersectionWrongWay>() != null) { // intersection = transform.GetComponentInParent<IntersectionWrongWay>(); if (UP.isActive) { UP.check(transform); } else if (LeftUp.isActive) { LeftUp.isWrongWay(transform); } else if (LeftSign.isActive) { LeftSign.isWrongWay(transform); } else if (RightSign.isActive) { RightSign.checkIsRight(transform); } else if (RightUp.isActive) { RightUp.checkIsRight(transform); } else if (LeftRight.isActive) { LeftRight.isWrongWay(transform); } else { //Debug.Log("nop"); IntersectionRules.isWrongWay(transform); } } }
private void OnTriggerExit(Collider other) { if (transform.name == "ColliderFirst") { var.x.flag2 = false; } if (transform.name == "ColliderSecond") { var.x.flag1 = false; } //ako je lijevi znak aktivan primjeni njegova pravila if (LeftSign.isActive) { LeftSign.checkIsRight(transform); } if (LeftUp.isActive) { LeftUp.checkIsRight(transform); } if (LeftRight.isActive) { LeftRight.checkIsRight(transform); } if (UP.isActive) { UP.checkIsRight(transform); } //ako je desni znak aktivan primjeni njegova pravila /* if (RightSign.isActive) * { * LeftSign.checkIsRight(transform); * }*/ if (transform.GetComponentInParent <IntersectionWrongWay>() != null) { intersection = transform.GetComponentInParent <IntersectionWrongWay>(); if (transform.name == "ColliderIntersection") { intersection.setAllFalse(); UP.isActive = false; LeftSign.isActive = false; RightSign.isActive = false; RightUp.isActive = false; LeftUp.isActive = false; LeftRight.isActive = false; UP.isActive = false; } } if (transform.name == "ColliderStop") { if (!StopSign.timerDone) { Debug.Log("NISI STAO NA STOP"); } StopSign.stopSignActive = false; } }