// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Return)) { //setState(MatchRuntimeStates.initPlayers); StopAllCoroutines(); GameUI_Canvas.Instance.countDown.OnTimerStopped.RemoveAllListeners(); nextState(); } if (Input.GetKeyDown(KeyCode.R) && activePlayer != null) { if (boomBall == null) { boomBall = GameStatics.Instance.spawnBoomBall(activePlayer.transform.position); } activePlayer.GetComponent <BombingActionMoves>().catchBall(boomBall); } if (activeState == MatchRuntimeStates.matchRunning) { playTime += Time.deltaTime; GameUI_Canvas.Instance.matchTimer.text = playTime.ToString("0.00"); } }
public void catchBall(BoomBall _ball) { _ball.isCarried = true; boomballRig = _ball.gameObject.GetComponent <Rigidbody2D>(); hasBall = true; //boomballRig.transform.parent = gameObject.transform; boomballRig.velocity = Vector3.zero; boomballRig.gravityScale = 0; }
private void Awake() { collider = GetComponent<Collider2D>(); isCarried = true; if (Instance == null) Instance = this; else Destroy(gameObject); }
private void prepareTeams() { if (teamsTurn == Teams.red) { setActivePlayer(players_teamRed[0]); } else { setActivePlayer(players_teamBlue[0]); } if (boomBall == null) { boomBall = GameStatics.Instance.spawnBoomBall(activePlayer.transform.position); } activePlayer.GetComponent <BombingActionMoves>().catchBall(boomBall); //Camera.main.GetComponent<CameraMovement>().target = players_teamRed[0].transform; GameUI_Canvas.Instance.countDown.OnTimerStopped.AddListener(delegate { nextState(); }); GameUI_Canvas.Instance.countDown.startTimer(prepareTime); }