/// <summary> /// <para> 작 성 자 : 이승엽 </para> /// <para> 작 성 일 : 2020.05.02 </para> /// <para> 내 용 : 캐릭터가 죽었을 때 해당 팀이 다 죽엇는지 체크하는 메서드</para> /// </summary> public void Func_CharacterDie(TEAM _team) { List <MD_Character> _characterArr; bool _isLeft; if (_team == TEAM.Left) { _isLeft = true; _characterArr = left_CharacterList; } else { _isLeft = false; _characterArr = right_CharacterList; } for (int i = 0; i < _characterArr.Count; i++) { if (!_characterArr[i].isDie) { // 아직 다 죽지 않음 return; } } // 다 죽었다면 if (_isLeft) { // 왼쪽팀이 다 죽음 } else { // 오른쪽 팀이 다 죽음 } }
public List <ROLE> GetRolesByUserTeam(USER user, TEAM team) { if (user == null) { throw new ArgumentNullException("user"); } if (team == null) { throw new ArgumentNullException("team"); } var userTeamRoles = _ctx.USER_TEAM_ROLEs.Where(x => x.USER == user && x.TEAM == team); List <ROLE> roles = new List <ROLE>(); foreach (var userTeamRole in userTeamRoles) { ROLE role = userTeamRole.ROLE; if (role != null) { roles.Add(role); } } return(roles); }
void setTeam(TEAM team) { if (team == TEAM.NULL) { Debug.LogWarning("WARNING : TEAM cannot be set to null"); return; } _team = team; foreach (Transform c in GetComponentsInChildren <Transform>()) { if (c.GetComponent <DamagingPoint> () != null) { c.gameObject.layer = LayerHelper.GetAttackBoxLayer(team); c.GetComponent <DamagingPoint> ().SetDamagableLayers(); } if (c.GetComponent <Hitbox> () != null) { c.gameObject.layer = LayerHelper.GetHitboxLayer(team); } } if (GetComponent <CharacterMovementHandler> () != null) { // print ("team : " + team); GetComponent <CharacterMovementHandler> ().SetLayerMask(LayerHelper.GetLayerMask(team)); } }
public void Initialize(ObjectManager Instance, TEAM team) { m_ObjectManager = Instance; m_team = team; m_AIPathfinder = GetComponent <AIDestinationSetter>(); StartCoroutine(StateMachine()); }
// Use this for initialization void Awake() { if (GameObject.Find("GameData") != null) { GAMEDATA = GameObject.Find("GameData").GetComponent <GameData> (); TEAM = GAMEDATA.currentTeam; TEAM.resetPoints(); } else { Debug.Log("No existing game file found."); } ENEMY = new TeamStatus(new Participant[] { new Participant(new Xenon(Character.BONDSTATE.ENEMY)), null, null }); foreach (Participant teammate in ENEMY.TEAMMATES) { if (teammate != null) { teammate.setTeam(ENEMY); } } Debug.Log("ALLIES: " + System.Convert.ToString(TEAM.TEAMMATES[0]) + ", " + System.Convert.ToString(TEAM.TEAMMATES[1]) + ", " + System.Convert.ToString(TEAM.TEAMMATES[2])); Debug.Log("ENEMIES " + System.Convert.ToString(ENEMY.TEAMMATES[0]) + ", " + System.Convert.ToString(ENEMY.TEAMMATES[1]) + ", " + System.Convert.ToString(ENEMY.TEAMMATES[2])); }
public static double NextDouble(TEAM t) { if (t == TEAM.HOME) return home_random.NextDouble(); else return away_random.NextDouble(); }
public static int GetAttackBoxLayer(TEAM team) { if (team == TEAM.ONE) { return(ATTACKBOX_TEAM_1); } else if (team == TEAM.TWO) { return(ATTACKBOX_TEAM_2); } else if (team == TEAM.THREE) { return(ATTACKBOX_TEAM_3); } else if (team == TEAM.FOUR) { return(ATTACKBOX_TEAM_4); } else if (team == TEAM.FIVE) { return(ATTACKBOX_TEAM_5); } else { Debug.Log("Warning : Wrong team number"); return(ATTACKBOX_TEAM_1); } }
public TeamRoleViewModel GetRolesByTeam(int teamId) { TEAM team = _teamRepository.GetTeamById(teamId); TeamRoleViewModel teamRoles = new TeamRoleViewModel(); if (team != null) { teamRoles.TeamId = team.ID; teamRoles.Roles = new List <RoleForTeamViewModel>(); var roles = _roleRepository.GetRolesByTeam(team); if (roles != null) { foreach (var role in roles) { int usersCount = _roleRepository.GetUsersByTeamRole(role, team).Count(); RoleForTeamViewModel teamRole = new RoleForTeamViewModel { RoleId = role.ID, RoleName = role.NAME, UsersInRoleCount = usersCount, IsDefaultRole = role.TEAM == null ? true : false }; teamRoles.Roles.Add(teamRole); } } } return(teamRoles); }
public void MovePuck(Item item, GameClient mover, int newX, int newY, TEAM team) { if (!_room.GetGameMap().ItemCanBePlacedHere(newX, newY)) { return; } var oldRoomCoord = item.Coordinate; if (oldRoomCoord.X == newX && oldRoomCoord.Y == newY) { return; } item.ExtraData = Convert.ToInt32(team).ToString(); item.UpdateNeeded = true; item.UpdateState(); double NewZ = _room.GetGameMap().Model.SqFloorHeight[newX, newY]; _room.SendPacket(new SlideObjectBundleComposer(item.GetX, item.GetY, item.GetZ, newX, newY, NewZ, 0, 0, item.Id)); _room.GetRoomItemHandler().SetFloorItem(mover, item, newX, newY, item.Rotation, false, false, false); if (mover == null || mover.GetHabbo() == null) { return; } var user = mover.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(mover.GetHabbo().Id); if (isBanzaiActive) { HandleBanzaiTiles(new Point(newX, newY), team, user); } }
// CONSTRUCTOR public Derp(double x, double y, TEAM team, DerpStats stats, DerpManager manager, List <Node> path) { this.x = x; this.y = y; this.team = team; this.stats = stats; this.manager = manager; this.path = path; if (team == TEAM.HOME) { pathID = 1; } else { pathID = path.Count - 2; } myID = nextDerpID++; // Set up my image! baseTexture = baseTextures["e0s1"]; baseOffset = baseOffsets["e0s1"]; }
public void AddTeam(TEAM team, USER_TEAM userTeam, USER_TEAM_ROLES userTeamRole) { _ctx.TEAMs.Add(team); _ctx.USERS_TEAMs.Add(userTeam); _ctx.USER_TEAM_ROLEs.Add(userTeamRole); _ctx.SaveChanges(); }
void roundOver(TEAM winner) { // if (winner == TEAM.ONE) { // _game.Team_1_Score++; // } else if (winner == TEAM.TWO) { // _game.Team_2_Score++; // } _game.State = GameCapturePoints.STATE.ROUND_OVER; _game.GetCurrentRound().Winner = winner; // _game.SetCurrentRoundWinner(winner); updateGameStatus(); if (_game.CurrentRound >= _game.MaxRound || _game.GetScore(winner) > (_game.MaxRound / 2)) { UIController.SINGLETON.GameWinner(winner); Invoke("clearRound", 1f); Invoke("newGame", GameCapturePoints.TIMER_COUNTER_GAME); } else { UIController.SINGLETON.RoundWinner(winner); Invoke("clearRound", 1f); Invoke("PrepRound", GameCapturePoints.TIMER_COUNTER_ROUND); } NetworkManager.SINGLETON.AllowControl(false); NetworkManager.SINGLETON.Targeted_RPC(photonView, "RPCEnableLavaCollider", false, 0f); }
public void StopGame(bool userTriggered = false) { this._gameStarted = false; this._room.GetGameManager().UnlockGates(); this._room.GetGameManager().StopGame(); ResetGame(); if (this.ExitTeleports.Count > 0) { foreach (Item ExitTile in ExitTeleports.Values.ToList()) { if (ExitTile.ExtraData == "1" || String.IsNullOrEmpty(ExitTile.ExtraData)) { ExitTile.ExtraData = "0"; } ExitTile.UpdateState(); } } TEAM Winners = this._room.GetGameManager().GetWinningTeam(); foreach (RoomUser User in this._room.GetRoomUserManager().GetUserList().ToList()) { User.FreezeLives = 0; if (User.Team == Winners) { User.UnIdle(); User.DanceId = 0; this._room.SendMessage(new ActionComposer(User.VirtualId, 1)); } if (ExitTeleports.Count > 0) { Item tile = _freezeTiles.Values.Where(x => x.GetX == User.X && x.GetY == User.Y).FirstOrDefault(); if (tile != null) { Item ExitTle = GetRandomExitTile(); if (ExitTle != null) { _room.GetGameMap().UpdateUserMovement(User.Coordinate, ExitTle.Coordinate, User); User.SetPos(ExitTle.GetX, ExitTle.GetY, ExitTle.GetZ); User.UpdateNeeded = true; if (User.IsAsleep) { User.UnIdle(); } } } } } if (!userTriggered) { _room.GetWired().TriggerEvent(WiredBoxType.TriggerGameEnds, null); } }
public void SpawnDerp(int xPos, int yPos, TEAM team, DerpStats stats) { int yStart = yPos / Field.BLOCK_HEIGHT; if (pathTraversals[yStart] == null) { MessageBox.Show("Failed to Spawn Derp at " + xPos + " " + yPos + ". No Hub."); return; } Derp babyDerp = new Derp(xPos, yPos, team, stats, this, pathTraversals[yStart]); // Add new derp to complete lists of derps derpsHash.Add(babyDerp.myID, babyDerp); derpsSpeed.Add(babyDerp.stats.key, babyDerp); // Also add the derp to its team-specific list if (team == TEAM.HOME) { homeDerps.Add(babyDerp); } else { awayDerps.Add(babyDerp); } }
void Start() { _team = GetComponent <Health>().Team; if (!isLocalPlayer) { BlueFlagPosition = GameObject.Find("BlueFlagPos").transform; RedFlagPosition = GameObject.Find("RedFlagPos").transform; _redScore = GameObject.Find("FlagDropRed").GetComponent <ScoreFlag>(); _blueScore = GameObject.Find("FlagDropBlue").GetComponent <ScoreFlag>(); } else { _characterMovement = GetComponent <CharacterMovement>(); } if (_team == TEAM.ONE) { BlueTeamUI.enabled = true; } else { RedTeamUI.enabled = true; } }
private void HandleMaxBanzaiTiles(Point coord, TEAM team) { if (team == TEAM.NONE) { return; } List <Item> items = _room.GetGameMap().GetCoordinatedItems(coord); foreach (Item _item in _banzaiTiles.Values.ToList()) { if (_item == null) { continue; } if (_item.GetBaseItem().InteractionType != InteractionType.banzaifloor) { continue; } if (_item.GetX != coord.X || _item.GetY != coord.Y) { continue; } SetMaxForTile(_item, team); _room.GetGameManager().AddPointToTeam(team, 1); _item.UpdateState(false, true); } }
public TeamMemberViewModel GetTeamMembers(int teamId, USER user = null) { TEAM team = _teamRepository.GetTeamById(teamId); TeamMemberViewModel teamMembers = new TeamMemberViewModel(); if (team != null) { var users = team.USERS_TEAMs.Select(x => x.USER); teamMembers.TeamId = team.ID; teamMembers.Members = new List <MemberViewModel>(); foreach (USER u in users) { MemberViewModel member = new MemberViewModel { UserId = u.Id, UserName = u.UserName, Email = u.Email, IsActualUser = (user != null && user.Id == u.Id), Roles = u.USER_TEAM_ROLEs.Where(x => x.TEAM_ID == teamId).Select(x => new RoleViewModel { RoleId = x.ROLE.ID, RoleName = x.ROLE.NAME, RoleDescription = x.ROLE.DESCRIPTION }).ToList() }; teamMembers.Members.Add(member); } } return(teamMembers); }
IEnumerator IEGameWinner(TEAM winner) { float timer = Time.time + 1f; TextWinner.gameObject.SetActive(true); int counter = GameCapturePoints.TIMER_COUNTER_GAME; while (counter > 0) { if (Time.time > timer) { timer = Time.time + 1f; counter--; if (winner == TEAM.NULL) { TextWinner.text = "Draw"; } else if (winner == (TEAM)PhotonNetwork.player.CustomProperties [RoomLevelHelper.CUSTOM_PLAYER_PROPERTY_TEAM]) { TextWinner.text = "Victory"; } else { TextWinner.text = "Defeat"; } TextWinner.text += "\n" + counter; } yield return(null); } TextWinner.text = ""; TextWinner.gameObject.SetActive(false); }
public bool CreateTeam(USER user, string teamName) { bool isNameFree = true; if (_teamRepository.GetTeamByName(teamName) == null) { ROLE role = _roleRepository.GetRoleByName("Leader"); TEAM team = new TEAM() { NAME = teamName }; USER_TEAM userTeam = new USER_TEAM() { TEAM = team, USER = user }; USER_TEAM_ROLES userTeamRole = new USER_TEAM_ROLES() { USER = user, TEAM = team, ROLE = role }; _teamRepository.AddTeam(team, userTeam, userTeamRole); } else { isNameFree = false; } return(isNameFree); }
public static int GetLayerMask(TEAM team) { // Debug.Log (team.ToString ()); if (team == TEAM.ONE) { return(TEAM_1_BODY); } else if (team == TEAM.TWO) { return(TEAM_2_BODY); } else if (team == TEAM.THREE) { return(TEAM_3_BODY); } else if (team == TEAM.FOUR) { return(TEAM_4_BODY); } else if (team == TEAM.FIVE) { return(TEAM_5_BODY); } else { Debug.Log("Warning : Wrong team number"); return(TEAM_1_BODY); } }
public IEnumerable <TeamMessageViewModel> GetTeamMessages(int teamId) { List <TeamMessageViewModel> teamMessages = new List <TeamMessageViewModel>(); TEAM team = _teamRepository.GetTeamById(teamId); if (team != null) { IEnumerable <MESSAGE> messages = _messageRepository.GetMessagesByTeam(team); if (messages != null) { foreach (MESSAGE msg in messages) { teamMessages.Add(new TeamMessageViewModel { MessageId = msg.ID, MessageTypeName = msg.MESSAGE_TYPE.NAME, IsReaded = msg.IS_READED, SendDate = msg.SEND_DATE, Sender = msg.USER_FROM, Title = MessageTypeNames.TEAM_JOIN_REQUEST + " from user " + msg.USER_FROM.UserName // DO ZMIANY }); } } } return(teamMessages.OrderByDescending(x => x.SendDate)); }
public RoleAssignViewModel GetMembersToAssign(int teamId, int roleId) { TEAM team = _teamRepository.GetTeamById(teamId); ROLE role = _roleRepository.GetRoleById(roleId); if (team != null && role != null) { var roleMembers = _roleRepository.GetUsersByTeamRole(role, team); var teamOtherMembers = _userRepository.GetUsersByTeam(team).Except(roleMembers); RoleAssignViewModel roleAssignModel = new RoleAssignViewModel { RoleId = role.ID, RoleName = role.NAME, TeamId = team.ID, RoleMembers = roleMembers.Select(x => new RoleAssignMemberModel { MemberId = x.Id, MemberName = x.UserName }), OtherTeamMembers = teamOtherMembers.Select(x => new RoleAssignMemberModel { MemberId = x.Id, MemberName = x.UserName }) }; return(roleAssignModel); } return(null); }
// devuelve el jugador del equipo team que este mas cerca del target public GameObject getMinPlayerToTarget(TEAM team, Transform target) { float minDistance = 1000000000000; int min = 0; GameObject[] teamGOs = { }; if (team == TEAM.A) { teamGOs = teamA; } else if (team == TEAM.B) { teamGOs = teamB; } for (int i = 0; i < teamGOs.Length; i++) { if (Vector3.Distance(teamGOs[i].gameObject.transform.position, target.position) < minDistance) { minDistance = Vector3.Distance(teamGOs[i].gameObject.transform.position, target.position); min = i; } } return(teamGOs[min]); }
public Goal(TEAM team, Vector3 left, Vector3 right, float width) { Team = team; LeftPost = left; RightPost = right; Width = width; }
public void Init() { currentTeam = startingTeam; turnCount = 0; isReady = true; }
public async Task <bool> AssignUserToTeamWithBasicRole(string userId, string assignerId, int teamId) { TEAM team = _teamRepository.GetTeamById(teamId); USER user = await _userRepository.GetUserById(userId); if (team != null && user != null) { USER_TEAM userTeam = new USER_TEAM { TEAM = team, USER = user }; ROLE basicRole = _roleRepository.GetBasicRole(); USER_TEAM_ROLES userTeamRole = new USER_TEAM_ROLES { USER = user, TEAM = team, ROLE = basicRole }; _teamRepository.AssignUserToTeamWithRole(userTeam, userTeamRole); await _messageService.RemoveTeamJoinRequestByUserFrom(user.Id, team.ID); await _messageService.CreateNewMessageForUser(user.Id, assignerId, "You have been assigned to " + team.NAME); return(true); } else { return(false); } }
/// <summary> /// Sets the spawn area which is used to detect if this spawn area is being used or not. Also enables linked protector /// </summary> /// <param name="spawningUnit">Spawning unit.</param> /// <param name="team">Spawning unit's Team.</param> public void SetSpawnArea(GameObject spawningUnit, TEAM team) { SetSpawnArea(spawningUnit); // gameObject.layer = LayerHelper.GetAttackBoxLayer (team); // if (_protector) // _protector.EnableProtector (team); }
public virtual void startDamage(TEAM t, Vector2 pos) { List <GameObject> units; if (t == TEAM.GREEN) { units = GameManager.instance.team1; } else { units = GameManager.instance.team2; } //Start animation coroutine here Vector2 center = Camera.main.ScreenToWorldPoint(Input.mousePosition); foreach (GameObject unit in units) { if (Vector2.Distance(center, unit.transform.position) < radius) { unit.BroadcastMessage("addHealth", -damage); Vector2 knockback = (Vector2)unit.transform.position - center; knockback = knockback.normalized * force; unit.GetComponent <Rigidbody2D>().AddForce(knockback); } } }
public void RespawnPlayer(GameObject player, TEAM playerTeam) { var point = PickRandomSpawnPoint(playerTeam); player.transform.position = point.transform.position; player.transform.rotation = point.transform.rotation; }
// note: l and h are inclusive and exclusive respectively public static int Next(TEAM t, int l, int h) { if (t == TEAM.HOME) return home_random.Next(l, h); else return away_random.Next(l, h); }
IEnumerator IERoundWinner(TEAM winner) { float timer = Time.time + 1f; TextWinner.gameObject.SetActive(true); int counter = GameCapturePoints.TIMER_COUNTER_ROUND; while (counter > 0) { if (Time.time > timer) { timer = Time.time + 1f; counter--; if (winner == TEAM.NULL) { TextWinner.text = "Round " + PvpManager.SINGLETON.GetGameInfo().CurrentRound + " Draw"; } else if (winner == (TEAM)PhotonNetwork.player.CustomProperties [RoomLevelHelper.CUSTOM_PLAYER_PROPERTY_TEAM]) { TextWinner.text = "Round " + PvpManager.SINGLETON.GetGameInfo().CurrentRound + " Won"; } else { TextWinner.text = "Round " + PvpManager.SINGLETON.GetGameInfo().CurrentRound + " Lost"; } TextWinner.text += "\n" + counter; } yield return(null); } TextWinner.text = ""; TextWinner.gameObject.SetActive(false); }
public static int Next(TEAM t) { if (t == TEAM.HOME) return home_random.Next(); else return away_random.Next(); }
public TaskListViewModel TaskList(int teamId, USER user) { TEAM team = _teamRepository.GetTeamById(teamId); if (team != null) { var tmpTaskStatuses = _taskRepository.GetTaskStatusesByTeam(team); if (tmpTaskStatuses != null && tmpTaskStatuses.Count() > 0) { var permissions = _permissionService.GetPermissionsForUserTeam(user, team.ID); TaskListViewModel taskListModel = new TaskListViewModel(); taskListModel.TeamId = team.ID; taskListModel.CanAssignTask = permissions.CanAssignTasks; taskListModel.CanCreateTask = permissions.CanCreateTasks; taskListModel.TasksByStatus = new List <TasksByStatusModel>(); IEnumerable <TASK_STATUS> taskStatuses = GetOrderedTaskStatuses(team); foreach (var taskStatus in taskStatuses) { TasksByStatusModel tasksByStatus = new TasksByStatusModel { TaskStatusId = taskStatus.ID, TaskStatusName = taskStatus.NAME, Tasks = _taskRepository.GetTasksByTeamAndStatus(team, taskStatus).OrderBy(x => x.DEATHLINE).ToList() }; taskListModel.TasksByStatus.Add(tasksByStatus); } return(taskListModel); } } return(null); }
public TeamScore GetTeamScore( TEAM _team ) { switch ( _team ) { case TEAM.TEAM_1: return this.team1Score; case TEAM.TEAM_2: return this.team2Score; default: DebugConsole.Error( "Unknown team " + _team ); return this.team1Score; } }
private int x, y; //x,y in grid units #endregion Fields #region Constructors // Constructor public Spawner(TEAM team, int x, int y, int BuildSpace, int ActiveEpoch) { this.team = team; this.x = x; this.y = y; worldX = x * Field.BLOCK_WIDTH; worldY = y * Field.BLOCK_HEIGHT; this.MaxLength = BuildSpace - 1; nextSpawnTime = spawningBaseTime + (MyRandom.NextDouble(team) * spawningVariance * 2 - spawningVariance); this.ActiveEpoch = ActiveEpoch; if (ActiveEpoch == 1) Active = true; }
public void AddFurnitureToTeam(Item item, TEAM team) { switch (team) { case TEAM.BLUE: _blueTeamItems.TryAdd(item.Id, item); break; case TEAM.GREEN: _greenTeamItems.TryAdd(item.Id, item); break; case TEAM.RED: _redTeamItems.TryAdd(item.Id, item); break; case TEAM.YELLOW: _yellowTeamItems.TryAdd(item.Id, item); break; } }
public void AddPointToTeam(TEAM team, int points) { int newPoints = this._teamPoints[Convert.ToInt32(team)] += points; if (newPoints < 0) newPoints = 0; this._teamPoints[Convert.ToInt32(team)] = newPoints; foreach (Item item in GetFurniItems(team).Values.ToList()) { if (!IsFootballGoal(item.GetBaseItem().InteractionType)) { item.ExtraData = this._teamPoints[Convert.ToInt32(team)].ToString(); item.UpdateState(); } } foreach (Item item in _room.GetRoomItemHandler().GetFloor.ToList()) { if (team == TEAM.BLUE && item.Data.InteractionType == InteractionType.banzaiscoreblue) { item.ExtraData = _teamPoints[Convert.ToInt32(team)].ToString(); item.UpdateState(); } else if (team == TEAM.RED && item.Data.InteractionType == InteractionType.banzaiscorered) { item.ExtraData = _teamPoints[Convert.ToInt32(team)].ToString(); item.UpdateState(); } else if (team == TEAM.GREEN && item.Data.InteractionType == InteractionType.banzaiscoregreen) { item.ExtraData = _teamPoints[Convert.ToInt32(team)].ToString(); item.UpdateState(); } else if (team == TEAM.YELLOW && item.Data.InteractionType == InteractionType.banzaiscoreyellow) { item.ExtraData = _teamPoints[Convert.ToInt32(team)].ToString(); item.UpdateState(); } } }
private void HandleMaxBanzaiTiles(Point coord, TEAM team) { if (team == TEAM.NONE) return; List<Item> items = _room.GetGameMap().GetCoordinatedItems(coord); foreach (Item _item in _banzaiTiles.Values.ToList()) { if (_item == null) continue; if (_item.GetBaseItem().InteractionType != InteractionType.banzaifloor) continue; if (_item.GetX != coord.X || _item.GetY != coord.Y) continue; SetMaxForTile(_item, team); _room.GetGameManager().AddPointToTeam(team, 1); _item.UpdateState(false, true); } }
private void SetTile(Item item, TEAM team, RoomUser user) { if (item.team == team) { if (item.value < 3) { item.value++; if (item.value == 3) { user.LockedTilesCount++; _room.GetGameManager().AddPointToTeam(item.team, 1); field.updateLocation(item.GetX, item.GetY, (byte)team); List<PointField> gfield = field.doUpdate(); TEAM t; foreach (PointField gameField in gfield) { t = (TEAM)gameField.forValue; foreach (Point p in gameField.getPoints()) { HandleMaxBanzaiTiles(new Point(p.X, p.Y), t); floorMap[p.Y, p.X] = gameField.forValue; } } } } } else { if (item.value < 3) { item.team = team; item.value = 1; } } int newColor = item.value + (Convert.ToInt32(item.team) * 3) - 1; item.ExtraData = newColor.ToString(); }
public CapitalShipMaster GetCapitalShip( TEAM _team ) { switch ( _team ) { case TEAM.TEAM_1: if ( this.commander1 == null ) { DebugConsole.Warning( "Commander 1 not found" ); return null; } return this.commander1.capitalShip; case TEAM.TEAM_2: if ( this.commander2 == null ) { DebugConsole.Warning( "Commander 2 not found" ); return null; } return this.commander2.capitalShip; default: DebugConsole.Error( "Could not find capital ship for team " + _team ); return null; } }
public GamePlayer GetCommander( TEAM _team ) { switch ( _team ) { case TEAM.TEAM_1: { return this.commander1; } case TEAM.TEAM_2: { return this.commander2; } default: { Debug.LogError( "Cannot fetch commander of team type " + _team ); return null; } } }
private void RenderCapitalShipHealth( TEAM _team, bool _left ) { GamePlayer capitalPlayer = GamePlayerManager.instance.GetCommander( _team ); if ( capitalPlayer != null && capitalPlayer.capitalShip != null ) { float barHeight = Screen.height * this.CSHealthBarRelativeLength; float barBase = Screen.height/2 - barHeight/2; CapitalHealth health = capitalPlayer.capitalShip.health; float healthRatio = health.currentHealth / health.maxHealth; float shieldRatio = health.currentShield / health.maxShield; healthRatio = healthRatio > 0.0f ? healthRatio : 0.0f; shieldRatio = shieldRatio > 0.0f ? shieldRatio : 0.0f; float alpha = health.timeSinceDealtDamage > this.csHealthDamageHighlightDuration ? 0.5f : 1.0f; GUI.color = new Color( 1.0f, 1.0f, 1.0f, alpha ); Rect rect = new Rect( _left ? this.CSHealthBarOffset : Screen.width - this.CSHealthBarOffset - csHealthBarWidth, barBase, this.csHealthBarWidth, barHeight ); this.RenderVerticalBarOverlaid( this.healthBarTexture, rect, healthRatio ); rect.x += (_left ? 1.0f : -1.0f) * (this.csHealthBarWidth + this.healthShieldBarGap); this.RenderVerticalBarOverlaid( this.shieldBarTexture, rect, shieldRatio ); } }
private PlayerDisplayRow CreatePlayerRow( TEAM _team, int _pos, int _fighterCount ) { PlayerDisplayRow row = new PlayerDisplayRow(); float xPos = this.playerRowOffset.x; float yPos = this.playerRowOffset.y + _pos * this.lobbyRowHeight; if ( _team == TEAM.TEAM_2 ) { yPos += this.lobbyTeamGap; } row.nameGUI = new GUIPlaceholder(); row.nameGUI.rect = new Rect( xPos, yPos, this.lobbyNameWidth, this.lobbyRowHeight ); xPos += this.lobbyNameWidth; row.ipGUI = new GUIPlaceholder(); row.ipGUI.rect = new Rect( xPos, yPos, this.lobbyIPWidth, this.lobbyRowHeight ); xPos += this.lobbyIPWidth; row.pingGUI = new GUIPlaceholder(); row.pingGUI.rect = new Rect( xPos, yPos, this.lobbyPingWidth, this.lobbyRowHeight ); return row; }
public void MovePuck(Item item, GameClient mover, int newX, int newY, TEAM team) { if (!_room.GetGameMap().itemCanBePlacedHere(newX, newY)) return; Point oldRoomCoord = item.Coordinate; if (oldRoomCoord.X == newX && oldRoomCoord.Y == newY) return; item.ExtraData = (Convert.ToInt32(team).ToString()); item.UpdateNeeded = true; item.UpdateState(); Double NewZ = _room.GetGameMap().Model.SqFloorHeight[newX, newY]; _room.SendMessage(new SlideObjectBundleComposer(item.GetX, item.GetY, item.GetZ, newX, newY, NewZ, 0, 0, item.Id)); _room.GetRoomItemHandler().SetFloorItem(mover, item, newX, newY, item.Rotation, false, false, false, false); if (mover == null || mover.GetHabbo() == null) return; RoomUser user = mover.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(mover.GetHabbo().Id); if (banzaiStarted) { HandleBanzaiTiles(new Point(newX, newY), team, user); } }
private int GetScoreForTeam(TEAM team) { return _teamPoints[Convert.ToInt32(team)]; }
private ConcurrentDictionary<int, Item> GetFurniItems(TEAM team) { switch (team) { default: return new ConcurrentDictionary<int, Item>(); case TEAM.BLUE: return this._blueTeamItems; case TEAM.GREEN: return this._greenTeamItems; case TEAM.RED: return this._redTeamItems; case TEAM.YELLOW: return this._yellowTeamItems; } }
public void RemoveFurnitureFromTeam(Item item, TEAM team) { switch (team) { case TEAM.BLUE: _blueTeamItems.TryRemove(item.Id, out item); break; case TEAM.GREEN: _greenTeamItems.TryRemove(item.Id, out item); break; case TEAM.RED: _redTeamItems.TryRemove(item.Id, out item); break; case TEAM.YELLOW: _yellowTeamItems.TryRemove(item.Id, out item); break; } }
private void HandleBanzaiTiles(Point coord, TEAM team, RoomUser user) { if (team == TEAM.NONE) return; List<Item> items = _room.GetGameMap().GetCoordinatedItems(coord); int i = 0; foreach (Item _item in _banzaiTiles.Values.ToList()) { if (_item == null) continue; if (_item.GetBaseItem().InteractionType != InteractionType.banzaifloor) { user.Team = TEAM.NONE; user.ApplyEffect(0); continue; } if (_item.ExtraData.Equals("5") || _item.ExtraData.Equals("8") || _item.ExtraData.Equals("11") || _item.ExtraData.Equals("14")) { i++; continue; } if (_item.GetX != coord.X || _item.GetY != coord.Y) continue; SetTile(_item, team, user); if (_item.ExtraData.Equals("5") || _item.ExtraData.Equals("8") || _item.ExtraData.Equals("11") || _item.ExtraData.Equals("14")) i++; _item.UpdateState(false, true); } if (i == _banzaiTiles.Count) BanzaiEnd(); }
public bool CanEnterOnTeam(TEAM t) { if (t.Equals(TEAM.BLUE)) return (BlueTeam.Count < 5); else if (t.Equals(TEAM.RED)) return (RedTeam.Count < 5); else if (t.Equals(TEAM.YELLOW)) return (YellowTeam.Count < 5); else if (t.Equals(TEAM.GREEN)) return (GreenTeam.Count < 5); return false; }
private static void SetMaxForTile(Item item, TEAM team) { if (item.value < 3) { item.value = 3; item.team = team; } int newColor = item.value + (Convert.ToInt32(item.team) * 3) - 1; item.ExtraData = newColor.ToString(); }
public Item(int Id, int RoomId, int BaseItem, string ExtraData, int X, int Y, Double Z, int Rot, int Userid, int Group, int limitedNumber, int limitedStack, string wallCoord, Room Room = null) { ItemData Data = null; if (PlusEnvironment.GetGame().GetItemManager().GetItem(BaseItem, out Data)) { this.Id = Id; this.RoomId = RoomId; this._room = Room; this._data = Data; this.BaseItem = BaseItem; this.ExtraData = ExtraData; this.GroupId = Group; this._coordX = X; this._coordY = Y; if (!double.IsInfinity(Z)) this._coordZ = Z; this.Rotation = Rot; this.UpdateNeeded = false; this.UpdateCounter = 0; this.InteractingUser = 0; this.InteractingUser2 = 0; this.interactingBallUser = 0; this.interactionCount = 0; this.value = 0; this.UserID = Userid; this.Username = PlusEnvironment.GetUsernameById(Userid); this.LimitedNo = limitedNumber; this.LimitedTot = limitedStack; switch (GetBaseItem().InteractionType) { case InteractionType.TELEPORT: RequestUpdate(0, true); break; case InteractionType.HOPPER: RequestUpdate(0, true); break; case InteractionType.ROLLER: mIsRoller = true; if (RoomId > 0) { GetRoom().GetRoomItemHandler().GotRollers = true; } break; case InteractionType.banzaiscoreblue: case InteractionType.footballcounterblue: case InteractionType.banzaigateblue: case InteractionType.FREEZE_BLUE_GATE: case InteractionType.freezebluecounter: team = TEAM.BLUE; break; case InteractionType.banzaiscoregreen: case InteractionType.footballcountergreen: case InteractionType.banzaigategreen: case InteractionType.freezegreencounter: case InteractionType.FREEZE_GREEN_GATE: team = TEAM.GREEN; break; case InteractionType.banzaiscorered: case InteractionType.footballcounterred: case InteractionType.banzaigatered: case InteractionType.freezeredcounter: case InteractionType.FREEZE_RED_GATE: team = TEAM.RED; break; case InteractionType.banzaiscoreyellow: case InteractionType.footballcounteryellow: case InteractionType.banzaigateyellow: case InteractionType.freezeyellowcounter: case InteractionType.FREEZE_YELLOW_GATE: team = TEAM.YELLOW; break; case InteractionType.banzaitele: { this.ExtraData = ""; break; } } this.mIsWallItem = (GetBaseItem().Type.ToString().ToLower() == "i"); this.mIsFloorItem = (GetBaseItem().Type.ToString().ToLower() == "s"); if (this.mIsFloorItem) { this._affectedPoints = Gamemap.GetAffectedTiles(GetBaseItem().Length, GetBaseItem().Width, GetX, GetY, Rot); } else if (this.mIsWallItem) { this.wallCoord = wallCoord; this.mIsWallItem = true; this.mIsFloorItem = false; this._affectedPoints = new Dictionary<int, ThreeDCoord>(); } } }
public void SendUndockedMessage( NetworkViewID _id, TEAM _team, int landedSlot ) { this.GetComponent<NetworkView>().RPC ( "OnFighterUndockedRPC", RPCMode.Others, _id, (int)_team, landedSlot ); }
/// <summary> /// Helper function to return the opposite team while returning an error if neutral /// </summary> /// <returns>The opposing team of the team given</returns> /// <param name="_team">The team</param> public static TEAM OpposingTeam( TEAM _team ) { if ( _team == TEAM.TEAM_1 ) { return TEAM.TEAM_2; } else if ( _team == TEAM.TEAM_2 ) { return TEAM.TEAM_1; } else { DebugConsole.Error( "Cannot find opposing team for neutral" ); return TEAM.NEUTRAL; } }