// Update is called once per frame void Update() { if (Input.GetKey("left shift")) { currentSpeed = runningSpeed; } if (Input.GetKeyUp("left shift")) { currentSpeed = movingSpeed; } if (Input.GetKey("a") && world.getClosestTileToDirection(transform.position, "west") != null) { gameObject.transform.Translate(new Vector2(-1, 0) * Time.deltaTime * currentSpeed); lastDirection = "west"; t = world.getClosestTile(gameObject).tag.ToString(); } if (Input.GetKey("d") && world.getClosestTileToDirection(transform.position, "east") != null) { gameObject.transform.Translate(new Vector2(1, 0) * Time.deltaTime * currentSpeed); lastDirection = "east"; } if (Input.GetKey("w") && world.getClosestTileToDirection(transform.position, "north") != null) { gameObject.transform.Translate(new Vector2(0, 1) * Time.deltaTime * currentSpeed); lastDirection = "north"; } if (Input.GetKey("s") && world.getClosestTileToDirection(transform.position, "south") != null) { gameObject.transform.Translate(new Vector2(0, -1) * Time.deltaTime * currentSpeed); lastDirection = "south"; } }
void plow() { curTool = bag.getSelectedTool(); if (curTool != null) { GameObject tile = world.getClosestTile(gameObject); tileproperties prop = tile.GetComponent <tileproperties>(); overlay.info = curTool.getPlowBonus().ToString(); if (curTool.getPlowBonus() > 0 && !prop.getPlowed() && prop.getPlowable()) { progress = true; overlay.castbar(workTime(bag.getSelectedTool().getPlowBonus())); prop.setPlowed(tile); progress = false; } } }