public void SetScores(GameManager.Team winningTeam, int blueScore, int redScore, Dictionary <string, int> blueScores, Dictionary <string, int> redScores) { winner.text = winningTeam.ToString() + " Team Wins!"; this.blueScore.text = "" + blueScore; this.redScore.text = "" + redScore; int nameOffset = 0; foreach (string name in blueScores.Keys) { Transform player = playerList.Find("player" + nameOffset); player.Find("Name").GetComponent <Text>().text = name; player.Find("Score").GetComponent <Text>().text = blueScores[name] + ""; nameOffset++; } nameOffset = 6; foreach (string name in redScores.Keys) { Transform player = playerList.Find("Player" + nameOffset); player.Find("Name").GetComponent <Text>().text = name; player.Find("Score").GetComponent <Text>().text = redScores[name] + ""; nameOffset++; } }
// ------------------------------------------------------------------------ /// @brief チームを設定 /// /// @param inTeam // ------------------------------------------------------------------------ void SetTeam() { var players = FindObjectsOfType <PlayerKicker>(); int left = 0; int right = 0; foreach (var item in players) { switch (item.mTeam) { case GameManager.Team.Left: ++left; break; case GameManager.Team.Right: ++right; break; } } Debug.LogWarningFormat("{0}:{1}", left, right); // mTeam = left < right ? GameManager.Team.Left : GameManager.Team.Right; mTeam = Random.Range(0, 2) == 0 ? GameManager.Team.Left : GameManager.Team.Right; var dic = new Dictionary <GameManager.Team, Color> { { GameManager.Team.Left, Color.red }, { GameManager.Team.Right, Color.blue }, }; mUserName.color = dic[mTeam]; }
private void OnTriggerStay(Collider other) { if (other.CompareTag("Unit")) { if (_ObjectReference != null) { if (_ObjectReference.gameObject != other.gameObject) { _ObjectReference = other.GetComponent <WorldObject>(); if (_ObjectReference != null) { CapturingTeam = _ObjectReference.Team; } } if (!_IsCapturing) { StartCapture(); } if (_ObjectReference != null) { CapturingTeam = _ObjectReference.Team; } } } }
public void start() { MGR = GameManager.GetInstance(); currentTurn = GameManager.Team.Human; BindEvents(); }
private void OnTriggerEnter(Collider other) { if (other.tag == "Player") { isRaid = true; WhoIsRaiding = other.GetComponent <AgentController>().Team; } }
private void OnTriggerExit(Collider other) { if (other.tag == "Player") { isRaid = false; WhoIsRaiding = GameManager.Team.E_NONE; } }
// ------------------------------------------------------------------------ /// @brief 同期 /// /// @param stream /// @param info // ------------------------------------------------------------------------ void IPunObservable.OnPhotonSerializeView(PhotonStream inStream, PhotonMessageInfo inInfo) { if (inStream.IsWriting) { inStream.SendNext(mTeam); return; } mTeam = (GameManager.Team)inStream.ReceiveNext(); }
public void Shoot(Vector2 playerAim, Vector3 playerLoc, GameManager.Team coloredBullets) { projectile = ShotManager.Instance.giveShot(); modiftySpeed(projectile); modifyArt(projectile); setDeathTime(projectile); projectile.GetComponent <Projectile>().setBulletTeamColor(coloredBullets); shotPattern.CastShot(playerAim, playerLoc, projectile); }
public void SetPlayerTeam(GameManager.Team playerTeam) { if (playerTeam == GameManager.Team.Blue) { playerInfoHUD.gameObject.GetComponent <Image>().color = new Color(Color.blue.r, Color.blue.g, Color.blue.b, .35f); } else if (playerTeam == GameManager.Team.Red) { playerInfoHUD.gameObject.GetComponent <Image>().color = new Color(Color.red.r, Color.red.g, Color.red.b, .35f);; } }
/// <summary> /// Checks if the conditions to capture have been met. /// </summary> private void CaptureProcess() { if (_IsCapturing) { if (_CaptureTickTimer < CaptureTickRate) { _CaptureTickTimer += Time.deltaTime; } else { _CaptureTickTimer = 0; if (_CaptureProgress < _CaptureProgressMax) { _CaptureProgress++; } } if (_CaptureProgress >= _CaptureProgressMax) { _IsCaptured = true; if (_ObjectReference != null) { CapturedTeam = _ObjectReference.Team; } } } if (_CaptureProgress > _CaptureProgressMax) { _CaptureProgress = _CaptureProgressMax; } if (!_IsCapturing) { if (_CaptureDecreaseTimer < CaptureDecreaseRate) { _CaptureDecreaseTimer += Time.deltaTime; } else { _CaptureDecreaseTimer = 0; if (_CaptureProgress <= _CaptureProgressMax && _CaptureProgress > 0) { _CaptureProgress--; } } if (_CaptureProgress <= 0) { _IsCaptured = false; } } }
// Update is called once per frame void Update() { if (isRaid) { bool isChangeOwner = false; if (WhoIsRaiding == TeamOwner) { if (TimeRemainingToClaim < TimeToClaim) { TimeRemainingToClaim += Time.deltaTime; } } else { if (TimeRemainingToClaim > 0) { TimeRemainingToClaim -= Time.deltaTime; } else { isChangeOwner = true; if (TeamOwner != GameManager.Team.E_NONE) { TeamOwner = GameManager.Team.E_NONE; } else { TeamOwner = WhoIsRaiding; } TimeRemainingToClaim = TimeToClaim; } } if (isChangeOwner) { Color color; switch (TeamOwner) { case GameManager.Team.E_BLUE: color = Color.blue; break; case GameManager.Team.E_RED: color = Color.red; break; default: color = Color.white; break; } m_objMaterial.material.SetColor("_Color", color); } } }
private void SpawnPlayer(GamePlayer player) { GameManager.Team playerTeam = player.GetTeam(); System.Random rand = new System.Random(); int random = rand.Next(spawnPoints[playerTeam].Count); Vector3 respawnPoint = spawnPoints[playerTeam][random]; player.transform.position = respawnPoint; player.SetHealth(100); player.EnablePlayer(); }
private void OnMouseDown() { Debug.Log("Red Team is Raiding"); isRaid = true; if (TeamOwner != GameManager.Team.E_RED) { WhoIsRaiding = GameManager.Team.E_RED; } else if (TeamOwner != GameManager.Team.E_BLUE) { WhoIsRaiding = GameManager.Team.E_BLUE; } }
//================================================================================================= //Interact Functions //================================================================================================= public void SetupPlayer(string playerName, GameManager.Team playerTeam) { if (!isServer) { return; } Debug.LogWarning("SETUP PLAYER ON SERVER: " + playerName); this.playerName = playerName; this.playerTeam = playerTeam; TargetSetupPlayer(this.connectionToClient); }
public void EndGame() { gameActive = false; int blueScore = 0; int redScore = 0; List <string> blueNames = new List <string>(); List <string> redNames = new List <string>(); List <int> blueScores = new List <int>(); List <int> redScores = new List <int>(); foreach (GamePlayer player in gamePlayers.Keys) { string name = player.GetName(); int score = gamePlayers[player]; GameManager.Team team = player.GetTeam(); if (team == GameManager.Team.Blue) { blueScore += score; blueNames.Add(name); blueScores.Add(score); } else if (team == GameManager.Team.Red) { redScore += score; redNames.Add(name); redScores.Add(score); } DespawnPlayer(player); } GameManager.Team winner; if (blueScore > redScore) { winner = GameManager.Team.Blue; } else if (redScore > blueScore) { winner = GameManager.Team.Red; } else { winner = GameManager.Team.NONE; } RpcEndGame(winner, blueScore, redScore, blueNames.ToArray(), blueScores.ToArray(), redNames.ToArray(), redScores.ToArray()); StartCoroutine(EndGameTimer()); }
private IEnumerator WaitForPlayerLoad(List <LobbyPlayerManager> lobbyPlayers, Dictionary <GamePlayer, int> gamePlayers, LobbyPlayerManager lobbyPlayer, GamePlayer gamePlayer) { yield return(new WaitUntil(() => gamePlayer.isServer)); Debug.LogWarning("DING"); int playerIndex = lobbyPlayers.IndexOf(lobbyPlayer); GameManager.Team playerTeam = (playerIndex < 6 ? GameManager.Team.Blue : GameManager.Team.Red); gamePlayer.SetupPlayer(lobbyPlayer.GetName(), playerTeam); Debug.LogWarning("Gameplayers add"); gamePlayers.Add(gamePlayer, 0); Debug.LogWarning("Gamelayers after add: " + gamePlayers.Keys.Count); if (gamePlayers.Keys.Count == playerCount) { StartGame(); } }
private void RpcEndGame(GameManager.Team winningTeam, int blueScore, int redScore, string[] blueNames, int[] blueScores, string[] redNames, int[] redScores) { MenuStateManager menuStates = MenuStateManager.GetMenuStateManager(); menuStates.EndGame(); Dictionary <string, int> blueTeam = new Dictionary <string, int>(); for (int loop = 0; loop < blueNames.Length; loop++) { blueTeam.Add(blueNames[loop], blueScores[loop]); } Dictionary <string, int> redTeam = new Dictionary <string, int>(); for (int loop = 0; loop < redNames.Length; loop++) { redTeam.Add(redNames[loop], redScores[loop]); } GameObject.Find("EndGameCanvas").GetComponent <EndGameScoreManager>().SetScores(winningTeam, blueScore, redScore, blueTeam, redTeam); }
// Use this for initialization void Start() { TeamOwner = GameManager.Team.E_NONE; TimeRemainingToClaim = TimeToClaim; m_objMaterial = GetComponent <Renderer>(); }
public void changeTeamColor(GameManager.Team TeamColor) { teamOn = TeamColor; }
public void setBulletTeamColor(GameManager.Team teamColorFiringShot) { colorOfBullet = teamColorFiringShot; }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> // Sets the team for this mine (so that friendlies cannot be damaged by it). /// </summary> /// <param name="team"></param> public void SetTeam(GameManager.Team team) { _Team = team; }