IEnumerator SnakeDecrease() { RotationHandler.Forbidden(); // float tmp = 0.0f; while (sState == "decrease" && oq_Snakes.Count != 0) { RotationHandler.Forbidden(); if (o_SnakeBodyParts == null || o_SnakeBodyPart == null) { Debug.Log("Something is missing: SnakeBodyPart or RotationHandler"); yield break; } if (!RotationHandler.IsRotating() && Time.timeScale != 0) { // while(tmp<0.1f){ // tmp += f_SnakeSpeed; // oq_Snakes.Enqueue(Instantiate(o_SnakeBodyPart, new Vector3(o_SnakeHead.transform.position.x, o_SnakeHead.transform.position.y, o_SnakeHead.transform.position.z) ,Quaternion.identity,o_SnakeBodyParts.transform)); // o_SnakeHead.transform.position += f_SnakeSpeed * Vector3.up; // Destroy(oq_Snakes.Dequeue()); // yield return null; // } Destroy(oq_Snakes.Dequeue()); } yield return(null); } o_SnakeHead.transform.position = v3_ObstaclePos; UpdateState("wait"); }
IEnumerator SnakeGrow() { i_maxOfInstant = Mathf.RoundToInt(f_SnakeLength / f_SnakeSpeed); // The min size of Snake is 1 unit if (f_SnakeLength < 1) { Debug.Log("SnakeLenght < 1!\n"); yield return(null); } if (o_SnakeBodyParts == null || o_SnakeBodyPart == null) { Debug.Log("Something is missing: SnakeBodyPart or RotationHandler"); yield break; } // Snake's Growth while (oq_Snakes.Count < i_maxOfInstant && sState == "grow") { if (!RotationHandler.IsRotating() && Time.timeScale != 0) { oq_Snakes.Enqueue(Instantiate(o_SnakeBodyPart, new Vector3(o_SnakeHead.transform.position.x, o_SnakeHead.transform.position.y, o_SnakeHead.transform.position.z), Quaternion.identity, o_SnakeBodyParts.transform)); o_SnakeHead.transform.position += f_SnakeSpeed * Vector3.up; } yield return(null); } if (oq_Snakes.Count >= i_maxOfInstant) { UpdateState("move"); } }
void Awake() { rh = FindObjectOfType <RotationHandler>(); mh = FindObjectOfType <MovementHandler>(); rotationStatusText = GameObject.Find("RotationStatusText").GetComponent <Text>(); movementStatusText = GameObject.Find("MovementStatusText").GetComponent <Text>(); }
public IImage build() { if (image.rotationCase != null) { RotationHandler.SetInitialRotation(image.rotationCase); } return(this.image); }
public PictureProcessor() : base() { BrightnessHandler = new BrightnessHandler(this); ContrastHandler = new ContrastHandler(this); GrayscaleHandler = new GrayscaleHandler(this); FileHandler = new ImageFileHandler(this); RotationHandler = new RotationHandler(this); }
// Update is called once per frame void Update() { if (!RotationHandler.IsRotating()) { if (IsTouchingBody()) { SnakeCollisionHandler.Allowed(); SnakeCollisionHandler.Handle(this.gameObject); SnakeCollisionHandler.Forbidden(); } } }
IEnumerator SnakeWait() { while (sState == "wait") { RotationHandler.Allowed(); if (RotationHandler.IsRotating()) { UpdateState("grow"); yield break; } yield return(null); } }
IEnumerator Leave() { Debug.Log(this.gameObject.name + ": state(leave)\n"); while (RotationHandler.IsRotating()) { yield return(null); } while (oSnakeHead.GetComponent <Collider>().bounds.Intersects(this.gameObject.GetComponent <Collider>().bounds) || RotationHandler.IsRotating()) { yield return(null); } UpdateState("wait"); }
IEnumerator Stay() { Debug.Log(this.gameObject.name + ": state(Stay)\n"); while (sState == "stay") { if (RotationHandler.IsRotating()) { UpdateState("leave"); yield break; } yield return(null); } }
IEnumerator LevelWait() { Debug.Log("Level State: Wait!\n"); InputManager.Allowed(); RotationHandler.Allowed(); while (sLevelState == "wait") { if (RotationHandler.IsRotating()) { UpdateLevelState("play"); yield break; } yield return(null); } }
public CurrentImageHandler() : base() { CurrentBrightnessHandler = new BrightnessHandler(this); CurrentContrastHandler = new ContrastHandler(this); CurrentCropHandler = new CropHandler(this); CurrentFilterHandler = new FilterHandler(this); CurrentGrayscaleHandler = new GrayscaleHandler(this); CurrentFileHandler = new ImageFileHandler(this); CurrentImgInsHandler = new ImageInsertionHandler(this); CurrentInvHandler = new InversionHandler(this); CurrentRotationHandler = new RotationHandler(this); CurrentSepiaToneHandler = new SepiaToneHandler(this); CurrentShapeInsHandler = new ShapeInsertionHandler(this); CurrentTextInsHandler = new TextInsertionHandler(this); }
IEnumerator LevelPlay() { InputManager.Allowed(); WorldObjectManager.UpdateState("play"); RotationHandler.Allowed(); SnakeCollisionHandler.Allowed(); Debug.Log("Level State: Play!\n"); while (sLevelState == "play") { GameObject oCollision = SnakeCollisionHandler.CollisionObject(); if (oCollision != null) { if (oCollision.tag == "Cube") { sReason = "die_cube"; UpdateLevelState("die"); yield break; } else if (oCollision.tag == "SnakeBodyPart") { sReason = "die_snake"; UpdateLevelState("die"); yield break; } else if (oCollision.tag == "Endpoint") { UpdateLevelState("win"); yield break; } // }else if(oCollision.tag == "Obstacle"){ // oSnake.GetComponent<WorldObject_Snake>().UpdateState("decrease"); // oCollision.GetComponent<WorldObject_Obstacle>().UpdateState("into"); // GameObject currCollision = SnakeCollisionHandler.CollisionObject(); // while(oCollision == currCollision /*|| oCollision.GetComponent<WorldObject_Obstacle>().CurrentState()!="wait"*/){ // currCollision = SnakeCollisionHandler.CollisionObject(); // yield return null; // } // // Debug.Log("Leave the Obstacle!\n"); // } } yield return(null); } }
// IEnumerator Coloring(){ // yield return this.gameObject.GetComponent<Material>().DOFade(0.0f,3.0f).WaitForCompletion(); // } IEnumerator Into() { RotationHandler.Forbidden(); Debug.Log(this.gameObject.name + ": state(Into)\n"); WorldObject_Snake.v3_ObstaclePos = this.transform.position; StartCoroutine("Shaking"); // StartCoroutine("Coloring"); while (sState == "into") { RotationHandler.Forbidden(); if (WorldObject_Snake.CurrentState() == "wait") { UpdateState("stay"); yield break; } yield return(null); } }
IEnumerator SnakeMove() { // int currCall = moveCalltimes++; while (sState == "move") { if (o_SnakeBodyParts == null || o_SnakeBodyPart == null) { Debug.Log("Something is missing: SnakeBodyPart or RotationHandler"); yield break; } if (!RotationHandler.IsRotating() && Time.timeScale != 0) { oq_Snakes.Enqueue(Instantiate(o_SnakeBodyPart, new Vector3(o_SnakeHead.transform.position.x, o_SnakeHead.transform.position.y, o_SnakeHead.transform.position.z), Quaternion.identity, o_SnakeBodyParts.transform)); o_SnakeHead.transform.position += f_SnakeSpeed * Vector3.up; Destroy(oq_Snakes.Dequeue()); } yield return(null); } // currCall = 0; }
public async Task MapRotation(CommandContext ctx) { await ctx.TriggerTypingAsync(); string result; try { result = await _httpclient.GetStringAsync($"https://api.mozambiquehe.re/maprotation?auth={_configuration.ApiTrackerKey}"); } catch (Exception) { await ctx.Channel.SendErrorAsync("An error occurred", "Couldn't fetch data"); return; } var rotation = RotationHandler.GetRotation(result); var rotationEmbed = RotationHandler.BuildRotationEmbed(rotation); await ctx.RespondAsync(rotationEmbed); }
void LevelStart() { Debug.Log("Level State: Start!\n"); // if(PlayerStats.CurrentLevel==0){ // LevelInfo.Level_test(); // } // Snake oSnake = GameObject.FindWithTag("Snake"); if (oSnake != null) { oSnake.GetComponent <WorldObject_Snake>().Initialize(); } // Object Initialize WorldObjectManager.Initialize(); // UI Initialize /* TODO */ // Input Forbidden InputManager.Forbidden(); RotationHandler.Forbidden(); // Switch To Next State UpdateLevelState("wait"); }
IEnumerator Wait() { Debug.Log(this.gameObject.name + ": state(wait)\n"); while (sState == "wait") { if (oSnakeHead.GetComponent <Collider>().bounds.Intersects(this.gameObject.GetComponent <Collider>().bounds) && !RotationHandler.IsRotating()) { UpdateState("into"); oSnake.GetComponent <WorldObject_Snake>().UpdateState("decrease"); yield break; } yield return(null); } }
public void Handle(CameraRotatingComponent component) { var rotate = new RotationHandler(camera); rotate.Execute(component); }