private void PathMakingOnTouch() { gameManager.isPathMaking = true; Touch touch = Input.touches[0]; Vector3 wp = Camera.main.ScreenToWorldPoint(touch.position); Vector2 touchPos = new Vector2(wp.x, wp.y); Collider2D collider2D = TouchControlHandler.GetOnVector2Collider(touchPos); if (collider2D != null) { if (collider2D.tag == "Base") { pathHandlerBase.ToBasePath(touchPos); aircraftMoveHandler.SetState(PlayerAircraftMoveHandler.State.ToBaseMove); } if (collider2D.tag == "Enemy") { pathHandlerBase.ChaseEnemyPath(collider2D.gameObject); aircraftMoveHandler.SetState(PlayerAircraftMoveHandler.State.FollowAircraft); } } else { pathHandlerBase.AddPointToPath(touchPos); } }
private void OnGameActiveTouch() { Touch touch = Input.touches[0]; if (touch.phase == TouchPhase.Began) { Collider2D touchColider = TouchControlHandler.getOnTouchCollider(touch); if (touchColider != null) { if (touchColider.tag == "aircraft") { PauseGameForPathMaking(); touchColider.gameObject.GetComponent <PlayerAircraftScript>().pathMakingHandler.StartPathMaking(); } else if (touchColider.tag == "Base") { touchColider.gameObject.GetComponent <AirBaseScript>().SpawnBaseUI(mainUiCanvas); } } } if (touch.phase == TouchPhase.Moved) { } }