// オブジェクトと接触した時に呼ばれるコールバック public void OnTriggerEnter2D(Collider2D hit) { Debug.Log("OnTriggerEnter2D"); if (initializeFlg) { // 接触したオブジェクトのタグが"Player"の場合 if (hit.gameObject.tag == "Player") { if (_goalState == GOAL_STATE.NONGOAL) { // Playerの勝ち Debug.Log("PlayerWin"); _playerController.ChangeGoalResultStatusWin(); //_rivalController.ChangeGoalResultStatusLose(); // 各種ステータスをゴールへ変更 _goalState = GOAL_STATE.GOAL; _playerController.ChangePlayerStatusGoal(); //_rivalController.ChangePlayerStatusGoal(); // GamePhotonManagerのゲームステータスをゴールへ変更 GameManager.gameStatus = GameManager.GameStatus.GOAL; // _goalStateの同期 /* * photonView.RPC("ChangeGoalState", PhotonTargets.AllViaServer); * photonView.RPC("ChangePlayerState", PhotonTargets.Others); */ } /* * else if (_goalState == GOAL_STATE.GOAL) * { * // Playerの負け * Debug.Log("PlayerLose"); * _playerController.ChangeGoalResultStatusLose(); * _rivalController.ChangeGoalResultStatusWin(); * * // 各種ステータスをゴールへ変更 * _goalState = GOAL_STATE.GOAL; * _playerController.ChangePlayerStatusGoal(); * _rivalController.ChangePlayerStatusGoal(); * } */ } /* * else if (hit.gameObject.name == "Rival") * { * _rivalController.ChangePlayerStatusGoal(); * } */ } else { Debug.Log(name + "が初期化されていません。"); } }
private void Start() { initializeFlg = false; _goalState = GOAL_STATE.NONGOAL; _playerController = null; //_rivalController = null; _goalPos = null; }