void Update() { if (CDS == null) { CDS = GameManager.CDS; } if (CDS != null && CDS.counterDownDone == true) { if (!CurrentLine) { lineLength = 0.0f; angle = 0; isCircle = false; CreateLine(); } if (Input.GetMouseButtonDown(0)) { if (CurrentLine) { drawLineRenderer.positionCount = 0; fingerPositions.Clear(); edgeCollider2D.points = new [] { new Vector2(), new Vector2() }; StopCoroutine(HideLine(lineId)); lineLength = 0.0f; angle = 0; isCircle = false; } CreateLine(); } if (Input.GetMouseButton(0) && fingerPositions.Count > 0) { Vector2 tempFingerPosition = Camera.main.ScreenToWorldPoint( Input.mousePosition); float newAddedLength = Vector2.Distance(tempFingerPosition, fingerPositions[fingerPositions.Count - 1]); lineLength += newAddedLength; if (lineLength > MAX_LENGTH) { CheckCircle(); return; } if (newAddedLength > 0.08f) { UpdateLine(tempFingerPosition); } } if (Input.GetMouseButtonUp(0)) { CheckCircle(); } } }
private void InitializeGameScene() { Debug.LogFormat( "GameManager.InitializeGameScene(): MainMenu.level: {0}", MainMenu.level); CDS = GameObject.Find("DelayedStart") .GetComponent <DelayedStartScript>(); int level = MainMenu.level; minX = -2; minY = -5; maxX = 2; maxY = 5; cureBallLifeTime = 7; minDistance = 0.4f; sec = 30; expectedScore = level > 100 ? (level % 100) * 20 : level * 20; Virus = GameObject.Find("Virus"); Virus.transform.localScale = Ball.GetBallSizeVector3(); GameObject CurrentLine = DrawLine.CurrentLine; Physics2D.IgnoreCollision(CurrentLine.GetComponent <Collider2D>(), Virus.GetComponent <Collider2D>()); timeText = GameObject.Find("TimeText").GetComponent <Text>(); timeText.text = makePrintableTime(sec); statusText = GameObject.Find("Status").GetComponent <Text>(); statusText.enabled = false; scoreToPass = GameObject.Find("ExpectedScore").GetComponent <Text>(); scoreToPass.text = "Expected Score: " + expectedScore; screenHeight = Screen.height; screenWidth = Screen.width; GameLevel gameLevel = (GameLevel)level; switch (gameLevel) { case GameLevel.TUTORIAL_1: SetSceneForTutorial1(); sec = 15; timeText = GameObject.Find("TimeText").GetComponent <Text>(); timeText.text = makePrintableTime(sec); Cells = GameObject.FindGameObjectsWithTag("NORMAL_BALL"); break; case GameLevel.TUTORIAL_2: SetSceneForTutorial2(); sec = 15; timeText = GameObject.Find("TimeText").GetComponent <Text>(); timeText.text = makePrintableTime(sec); Cells = GameObject.FindGameObjectsWithTag("NORMAL_BALL"); break; case GameLevel.TUTORIAL_3: SetSceneForTutorial3(); sec = 20; timeText = GameObject.Find("TimeText").GetComponent <Text>(); timeText.text = makePrintableTime(sec); Cells = GameObject.FindGameObjectsWithTag("NORMAL_BALL"); break; case GameLevel.NORMAL_1: CreateBallsRandomly(); Cells = GameObject.FindGameObjectsWithTag("NORMAL_BALL"); break; case GameLevel.NORMAL_2: CreateBallsRandomly(); Cells = GameObject.FindGameObjectsWithTag("NORMAL_BALL"); break; case GameLevel.NORMAL_3: CreateBallsRandomly(); Cells = GameObject.FindGameObjectsWithTag("NORMAL_BALL"); break; case GameLevel.YEAR_2020: CreateBallsRandomly(); TurnVirusIntoAsymtomatic(); Cells = GameObject.FindGameObjectsWithTag("NORMAL_BALL"); break; default: break; } }
public void SetCountDownNow() { CDS = GameObject.Find("DelayedStart") .GetComponent <DelayedStartScript>(); CDS.counterDownDone = true; }