void MoveToPositionJunction() //if player is currently not moving, moves him current direction to next junction { try { movePosition = MapUtility.GetJunctionPosition(MapUtility.TranslateWorldToMapCoordinates(transform.gameObject), currentDirection); } catch (Exception e) { e.GetType(); movePosition = MapUtility.GetDeadEndPosition(MapUtility.TranslateWorldToMapCoordinates(transform.gameObject), transform.gameObject, currentDirection); } Destroy(currentTarget); currentTarget = Instantiate(targetPrefab) as GameObject; currentTarget.transform.parent = GameFunctions.GetAxisOrigin().transform; if (!GameFunctions.IsDebbuging()) { currentTarget.SetActive(false); } currentTarget.transform.localPosition = movePosition; iTween.MoveTo(transform.gameObject, iTween.Hash("position", movePosition, "speed", speed, "islocal", true, "easetype", "linear", "oncomplete", "StopMovingJunction", "name", id)); }
void MoveToPositionJunction(int[] startingPosition) //if player is currently not moving, moves him current direction to next junction { Vector3 movePosition = MapUtility.GetJunctionPosition(startingPosition, currentDirection); targetCoordinates = MapUtility.TranslateWorldToMapCoordinates(movePosition); iTween.MoveTo(transform.gameObject, iTween.Hash("position", movePosition, "speed", speed, "islocal", true, "easetype", "linear", "oncomplete", "StopMovingJunction", "name", id)); }