public RespawnPoint(MyVector pos, MyVector rotation, GameTeam team) { position = pos; timeSinceUse = RespawnCooldown; orientation = MyQuaternion.FromEulerAngles(rotation.X, rotation.Y, rotation.Z); this.team = team; }
public override void ChangePlayerTeam(Player player, GameTeam newTeam) { World.Instance.ChangeTeam(player, newTeam); if (player == this.player) { if (newTeam == GameTeam.Assassins) clientNetworkLayer.ChangeTeam(clientNetworkLayer.CurrentGameInfo.TeamScoreList[0].TeamId); else clientNetworkLayer.ChangeTeam(clientNetworkLayer.CurrentGameInfo.TeamScoreList[1].TeamId); } }
public virtual void Change(GameCustomCharacterData customCharacterDataTo) { customCharacterData = customCharacterDataTo; //customCharacterDataCurrent = customCharacterDataTo; CheckData(); if (gameCustomPlayerContainer != null) { gameCustomPlayerContainer.customCharacterData = customCharacterData; } //LogUtil.Log("GameCustomBase:Change:characterData:" + characterData.teamCode); if (customCharacterData != null) { //customCharacterData.presetColorCode = customCharacterData.presetColorCode; //customCharacterData.presetTextureCode = customCharacterData.presetTextureCode; //LogUtil.Log("GameCustomBase:Change:customColorCode:" + customColorCode); //LogUtil.Log("GameCustomBase:Change:customTextureCode:" + customTextureCode); if (!string.IsNullOrEmpty(customCharacterData.teamCode) && customCharacterData.teamCode != "default") { //LogUtil.Log("Loading TEAM Custom Type:characterData.teamCode:" + characterData.teamCode); GameTeam team = GameTeams.Instance.GetById(customCharacterData.teamCode); if (team != null) { if (team.data != null) { customCharacterData.teamCode = team.code; customCharacterData.type = GameCustomTypes.teamType; //LogUtil.Log("Loading TEAM EXISTS Type:teamCode:" + teamCode); GameDataTexturePreset itemTexture = team.data.GetTexturePreset(); if (itemTexture != null) { customCharacterData.presetTextureCode = itemTexture.code; customCharacterDataCurrent.lastCustomColorCode = "--"; } GameDataColorPreset itemColor = team.data.GetColorPreset(); if (itemColor != null) { customCharacterData.presetColorCode = itemColor.code; customCharacterDataCurrent.lastCustomTextureCode = "--"; } } GameCustomController.UpdateCharacterDisplay( gameObject, team.display_name, UnityEngine.Random.Range(1, 99).ToString()); } } } UpdatePlayer(); }
public IGameControl GetControl(GameTeam team) { ControlsByTeam.TryGetValue(team, out var control); return(control); }
public void DeclareWiner(GameTeam team) { Debug.Log(team + " won!"); isGamePlaying = false; Time.timeScale = 0.1f; }
public override void LoadItemData(string data) { this.Team = (GameTeam)int.Parse(data); }
public async Task <IActionResult> OnGetAsync(int GroupId, int TeamId, int StepId) { Group = await _context.GameGroups.FindAsync(GroupId); if (Group == null) { return(RedirectToPage("/error", new { errorMessage = "That's Odd! We weren't able to find that Group" })); } Team = await _context.GameTeams.FindAsync(TeamId); if (Team == null) { return(RedirectToPage("/error", new { errorMessage = "That's Odd! We were not able to find that Team" })); } if (Team.GroupId != Group.Id) { return(RedirectToPage("/error", new { errorMessage = "That's Odd! The Team and Group do not match" })); } string BibleId = await GameTeam.GetValidBibleIdAsync(_context, null); // Now let's check that StepId if (StepId == Team.CurrentStepId) { PathNode CurrentStep = await _context.PathNodes.FindAsync(Team.CurrentStepId); if (CurrentStep == null) { return(RedirectToPage("/error", new { errorMessage = "That's Very Odd! We couldn't find Current Step" })); } _ = await CurrentStep.AddGenericStepPropertiesAsync(_context, BibleId); _ = await CurrentStep.AddPathStepPropertiesAsync(_context); // We have a winner! Let's update the Team Object _context.Attach(Team); Team.Modified = DateTime.Now; if (CurrentStep.FWStepId > 0) { Team.CurrentStepId = CurrentStep.FWStepId; Team.StepNumber = Team.StepNumber + 1; Team.BoardState = (int)GameTeam.GameBoardState.WordSelect; } else { Team.BoardState = (int)GameTeam.GameBoardState.Completed; } await _context.SaveChangesAsync(); // We need to add the Quotes around the TeamID, then signal the StateChange string GroupName = "\"" + Team.Id.ToString() + "\""; await _hubContext.Clients.Group(GroupName).SendAsync("StateChange"); return(RedirectToPage("Team", new { GroupId = Team.GroupId, TeamId = Team.Id, Message = "Good Job! You're on the right Path" })); } else { _context.Attach(Team); Team.Modified = DateTime.Now; Team.BoardState = (int)GameTeam.GameBoardState.WordSelectOffPath; await _context.SaveChangesAsync(); // We need to add the Quotes around the TeamID, then signal the StateChange string GroupName = "\"" + Team.Id.ToString() + "\""; await _hubContext.Clients.Group(GroupName).SendAsync("StateChange"); return(RedirectToPage("Team", new { GroupId = Team.GroupId, TeamId = Team.Id, Message = "Uh Oh! You've drifted off Path" })); } }
public abstract void ChangePlayerTeam(Player player, GameTeam team);
public override void ChangePlayerTeam(Player player, GameTeam newTeam) { World.Instance.ChangeTeam(player, newTeam); if (player == this.player) { if (newTeam == GameTeam.Assassins) serverNetworkLayer.Client.ChangeTeam(serverNetworkLayer.Client.CurrentGameInfo.TeamScoreList[0].TeamId); else serverNetworkLayer.Client.ChangeTeam(serverNetworkLayer.Client.CurrentGameInfo.TeamScoreList[1].TeamId); //if (newTeam == GameTeam.Assassins) // serverNetworkLayer.Client.ChangeTeam(13); //else // serverNetworkLayer.Client.ChangeTeam(39); } }
public override void EndRound(GameTeam defeatedTeam) { base.EndRound(defeatedTeam); World.Instance.Paused = true; if (defeatedTeam == GameTeam.Assassins) { List<TeamData> teams = new List<TeamData>(); TeamData data; data = serverNetworkLayer.Client.CurrentGameInfo.TeamScoreList[1]; data.TeamScore++; teams.Add(data); serverNetworkLayer.UpdatePlayerHealthAndTeamScore(new List<PlayerHealthData>(), teams); } else if(defeatedTeam== GameTeam.Knights) { List<TeamData> teams = new List<TeamData>(); TeamData data; data = serverNetworkLayer.Client.CurrentGameInfo.TeamScoreList[0]; data.TeamScore++; teams.Add(data); serverNetworkLayer.UpdatePlayerHealthAndTeamScore(new List<PlayerHealthData>(), teams); } gameStatus = GameStatus.WaitingForStart; if (defeatedTeam == player.CharacterClass.GameTeam) { SoundSystem.SoundEngine.PlaySound(SoundSystem.Enums.SoundTypes.fanfare1, (Vector3)player.CurrentCharacter.Position); } else { SoundSystem.SoundEngine.PlaySound(SoundSystem.Enums.SoundTypes.defeat, (Vector3)player.CurrentCharacter.Position); } //siec? }
public FigureEntity(IFigureDef def, GameTeam team) { Def = def; Team = team; }
public PointField(GameTeam gameTeam) { this.PointList = new List <Point>(); this.GameTeam = gameTeam; }
public void DoFootballMath(RoomItemBall football, int direction, int power) { int originalX = football.X; int originalY = football.Y; int footballX = football.X; int footballY = football.Y; double originalZ = football.Z; football.ExtraData = power.ToString(); football.UpdateState(false, true); if (direction == 4) { footballY++; this.DoFootballHitTest(football, footballX, footballY, 4, 0); } else { if (direction == 0) { footballY--; this.DoFootballHitTest(football, footballX, footballY, 0, 4); } else { if (direction == 6) { footballX--; this.DoFootballHitTest(football, footballX, footballY, 6, 2); } else { if (direction == 2) { footballX++; this.DoFootballHitTest(football, footballX, footballY, 2, 6); } else { if (direction == 3) { footballX++; footballY++; if (!this.DoFootballHitTest(football, footballX, footballY, 3, 3)) { bool rightAvaible = this.FootballCanMoveTo(football, football.X + 1, football.Y); bool leftAvaible = this.FootballCanMoveTo(football, football.X, football.Y + 1); if (!rightAvaible && !leftAvaible) { football.FootballDirection = 7; } else if (!rightAvaible && leftAvaible) { football.FootballDirection = 5; } else { football.FootballDirection = 1; } football.FootballWaitTime = 3; } } else { if (direction == 1) { footballX++; footballY--; if (!this.DoFootballHitTest(football, footballX, footballY, 1, 3)) { bool leftAvaible = this.FootballCanMoveTo(football, football.X + 1, football.Y); bool rightAvaible = this.FootballCanMoveTo(football, football.X, football.Y - 1); if (!leftAvaible && !rightAvaible) { football.FootballDirection = 5; } else if (leftAvaible) { football.FootballDirection = 3; } else { football.FootballDirection = 7; } football.FootballWaitTime = 3; } } else { if (direction == 7) { footballX--; footballY--; if (!this.DoFootballHitTest(football, footballX, footballY, 7, 3)) { bool leftAvaible = this.FootballCanMoveTo(football, football.X - 1, football.Y); bool rightAvaible = this.FootballCanMoveTo(football, football.X - 1, football.Y); if (leftAvaible && !rightAvaible) { football.FootballDirection = 3; } else if (leftAvaible && rightAvaible) { football.FootballDirection = 5; } else { football.FootballDirection = 1; } football.FootballWaitTime = 3; } } else { if (direction == 5) { footballX--; footballY++; if (!this.DoFootballHitTest(football, footballX, footballY, 5, 3)) { bool leftAvaible = this.FootballCanMoveTo(football, football.X - 1, football.Y); bool rightAvaible = this.FootballCanMoveTo(football, football.X, football.Y + 1); if (!leftAvaible && rightAvaible) { football.FootballDirection = 3; } else { football.FootballDirection = 7; } football.FootballWaitTime = 3; } } } } } } } } } if (originalX == football.X && originalY == football.Y) //no movement { return; } this.Room.RoomItemManager.MoveAnimation[football.ID] = new RoomItemRollerMovement(football.ID, originalX, originalY, originalZ, 0, football.X, football.Y, football.Z); GameTeam goal = GameTeam.None; foreach (RoomItemFootballGoal goal_ in this.Room.RoomItemManager.FloorItems.Get(typeof(RoomItemFootballGoal))) { GameTeam currentGoal = GameTeam.None; if (goal_.GetBaseItem().InteractionType.ToLower() == "blue_goal") { currentGoal = GameTeam.Blue; } else if (goal_.GetBaseItem().InteractionType.ToLower() == "green_goal") { currentGoal = GameTeam.Green; } else if (goal_.GetBaseItem().InteractionType.ToLower() == "yellow_goal") { currentGoal = GameTeam.Yellow; } else if (goal_.GetBaseItem().InteractionType.ToLower() == "red_goal") { currentGoal = GameTeam.Red; } if (currentGoal != GameTeam.None) { if (football.X == goal_.X && football.Y == goal_.Y) { goal = currentGoal; break; } else { bool found = false; foreach (AffectedTile tile in goal_.AffectedTiles) { if (tile.X == football.X && tile.Y == football.Y) { goal = currentGoal; found = true; break; } } if (found) { break; } } } } if (goal != GameTeam.None) //ITS A F*****G SCOREEEEEEEE { football.ExtraData = "10"; football.UpdateState(false, true); if (football.LastUserHitFootball != null) { this.Room.SendToAll(new MultiRevisionServerMessage(OutgoingPacketsEnum.Wave, new ValueHolder("VirtualID", football.LastUserHitFootball.VirtualID))); football.LastUserHitFootball.Session.GetHabbo().GetUserStats().FootballGoalScorer++; football.LastUserHitFootball.Session.GetHabbo().GetUserAchievements().CheckAchievement("FootballGoalScorer"); this.Room.FootballGoalHost(1); } this.GoalScore(goal); } }
/// <summary> /// calculate the next state of this game /// </summary> /// <param name="starter">player id of the starter of this ending hand</param> /// <param name="score">socre got by the team without starter</param> /// <returns>the starter of next hand</returns> public PlayerEntity NextRank(string starter, int score) { PlayerEntity nextStarter = null; if (!Players.Exists(p => p.PlayerId == starter)) { //log return(null); } GameTeam starterTeam = Players.Single(p => p.PlayerId == starter).Team; if (score >= 80) { nextStarter = GetNextPlayerAfterThePlayer(false, starter); foreach (PlayerEntity player in Players) { int scoreCopy = score; while (scoreCopy >= 120) { //2,J必打 if (player.Team != starterTeam && player.Rank != 0 && player.Rank != 9) { player.Rank = player.Rank + 1; scoreCopy -= 40; } else { break; } } } } else { nextStarter = GetNextPlayerAfterThePlayer(true, starter); if (score == 0) { foreach (PlayerEntity player in Players) { if (player.Team == starterTeam) { //J必打 if (player.Rank < 9 && player.Rank + 3 > 9) { player.Rank = 9; } else { player.Rank = player.Rank + 3; } } } } else if (score < 40) { foreach (PlayerEntity player in Players) { if (player.Team == starterTeam) { //J必打 if (player.Rank < 9 && player.Rank + 2 > 9) { player.Rank = 9; } else { player.Rank = player.Rank + 2; } } } } else { foreach (PlayerEntity player in Players) { if (player.Team == starterTeam) { player.Rank = player.Rank + 1; } } } } return(nextStarter); }
public WeaponClass GetWeaponClassByID(UDPClientServerCommons.Constants.WeaponEnumeration weapon, GameTeam team) { if (team == GameTeam.Assassins) { if (weapon == UDPClientServerCommons.Constants.WeaponEnumeration.CrossBow) return ObjectCache.Instance.GetWeapon("Pipe"); if (weapon == UDPClientServerCommons.Constants.WeaponEnumeration.Sword) return ObjectCache.Instance.GetWeapon("Fireball"); } else if (team == GameTeam.Knights) { if (weapon == UDPClientServerCommons.Constants.WeaponEnumeration.CrossBow) return ObjectCache.Instance.GetWeapon("Crossbow"); if (weapon == UDPClientServerCommons.Constants.WeaponEnumeration.Sword) return ObjectCache.Instance.GetWeapon("Grenade"); } return null; }
public UDPClientServerCommons.Constants.WeaponEnumeration GetWeaponIDByClass(WeaponClass wc, GameTeam team) { if (team == GameTeam.Assassins) { if (wc is PipeClass) return UDPClientServerCommons.Constants.WeaponEnumeration.Sword; if (wc is FireballClass) return UDPClientServerCommons.Constants.WeaponEnumeration.CrossBow; } else if (team == GameTeam.Knights) { if (wc is CrossbowClass) return UDPClientServerCommons.Constants.WeaponEnumeration.Sword; if (wc is GrenadeClass) return UDPClientServerCommons.Constants.WeaponEnumeration.CrossBow; } return UDPClientServerCommons.Constants.WeaponEnumeration.None; }
public override void EndRound(GameTeam defeatedTeam) { base.EndRound(defeatedTeam); World.Instance.Paused = true; gameStatus = GameStatus.WaitingForStart; if (defeatedTeam == player.CharacterClass.GameTeam) { SoundSystem.SoundEngine.PlaySound(SoundSystem.Enums.SoundTypes.fanfare1, (Vector3)player.CurrentCharacter.Position); } else { SoundSystem.SoundEngine.PlaySound(SoundSystem.Enums.SoundTypes.defeat, (Vector3)player.CurrentCharacter.Position); } }
public virtual void EndRound(GameTeam defeatedTeam) { if (defeatedTeam == GameTeam.Assassins) knightsScore++; else if (defeatedTeam == GameTeam.Knights) assassinsScore++; }
public void updateLocation(int x, int y, GameTeam value) { this.newEntries.Enqueue(new RoomBattleBanzaiTileStateUpdate(x, y, value)); }
//New GameLevel Method public void AddPlayer(SkyPlayer player) { if (player.Level != this && player.Level is GameLevel level) { level.RemovePlayer(player, true); //Clear from old world } //Remove a player from _incomingPlayers only if it's non-empty. //Avoid claiming a lock for a useless check if (_incomingPlayers.Count > 0) { lock (_incomingPlayers) { if (_incomingPlayers.ContainsKey(player.Username)) { _incomingPlayers.Remove(player.Username); } } } GameTeam defaultTeam = GetDefaultTeam(); SetPlayerTeam(player, defaultTeam); //SkyUtil.log($"Added {player.Username} to team {defaultTeam.DisplayName} in game {GameId}"); /*if (player.Level != this) * { * //Only show the level transition screen to players changing games on this instance * //player.SpawnLevel(this, GameLevelInfo.LobbyLocation, !_incomingPlayers.ContainsKey(player.Username)); * player.SpawnLevel(this, GameLevelInfo.LobbyLocation, false); //Remove loading screen to prevent 'building terrain' issue * } * else //Still teleport the player to the spawn location * { * player.Teleport(GameLevelInfo.LobbyLocation); * }*/ //Fix for maps on first join to an instance player.SpawnLevel(this, GameLevelInfo.LobbyLocation, false); //Remove loading screen to prevent 'building terrain' issue try { CurrentState.InitializePlayer(this, player); } catch (Exception e) { BugSnagUtil.ReportBug(e, this, CurrentState, player); } //Update Time McpeSetTime message = McpeSetTime.CreateObject(); message.time = GameLevelInfo.WorldTime; player.SendPackage(message); // //Pending Tasks //Attempts to execute tasks like spawning NPCs in once a single player has loaded the world if (_shouldSchedule) { _shouldSchedule = false; if (_pendingTasks.Count > 0) { foreach (SkyCoreAPI.PendingTask pendingTask in _pendingTasks) { RunnableTask.RunTaskLater(() => { try { pendingTask.Invoke(); } catch (Exception e) { BugSnagUtil.ReportBug(e, new AnonMetadatable((metadata) => { metadata.AddToTab("PendingTask", "Target", pendingTask.Target); metadata.AddToTab("PendingTask", "Method", pendingTask.Method); })); } }, 250); //Small delay for the level to initialize } _pendingTasks.Clear(); } } }
/// <summary> /// 移除队伍 /// </summary> /// <param name="team">队伍</param> /// <returns></returns> public bool RemoveTeam(GameTeam team) { return(Teams.Remove(team)); }
public RoomItemWiredJoinTeam(uint id, uint roomId, uint userId, Item baseItem, string extraData, int x, int y, double z, int rot, WallCoordinate wallCoordinate, Room room) : base(id, roomId, userId, baseItem, extraData, x, y, z, rot, wallCoordinate, room) { this.Team = GameTeam.Red; }
// To protect from overposting attacks, please enable the specific properties you want to bind to, for // more details see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { IdentityUser user = await _userManager.GetUserAsync(User); if (!ModelState.IsValid) { ViewData["PathSelectList"] = await GameGroup.GetPathSelectListAsync(_context); return(Page()); } // Now let's create an empty group var emptyGroup = new GameGroup { Created = DateTime.Now, Modified = DateTime.Now, GroupState = (int)GameGroup.GameGroupState.Open, Owner = user.Email }; if (await TryUpdateModelAsync <GameGroup>( emptyGroup, "Group", // Prefix for form value. g => g.Name, g => g.PathId)) { _context.GameGroups.Add(emptyGroup); await _context.SaveChangesAsync(); // go get the Path so we can set first step Path path = await _context.Paths.FindAsync(emptyGroup.PathId); if (path == null) { return(RedirectToPage("/error", new { errorMessage = "That's Very Odd! We were not able to find the Path for this Group" })); } // We will need that first step. _ = await path.AddCalculatedPropertiesAsync(_context); // Now we need to parse our Teams and add/remove foreach (GameTeam Team in Teams) { if (Team.Name != null) { if (Team.Name.Length > 0) { var emptyTeam = new GameTeam { CurrentStepId = path.FirstStepId, TeamType = 0, BoardState = (int)GameTeam.GameBoardState.WordSelect, StepNumber = 1, Created = DateTime.Now, Modified = DateTime.Now, }; emptyTeam.Name = Team.Name; emptyTeam.Group = emptyGroup; _context.GameTeams.Add(emptyTeam); } } } await _context.SaveChangesAsync(); return(RedirectToPage("Group", new { Id = emptyGroup.Id, Message = String.Format("Group {0} successfully created...", emptyGroup.Name) })); } return(Page()); }
public void ChangeTeam(Player player, GameTeam newTeam) { if (player.CharacterClass != null) { if (newTeam != player.CharacterClass.GameTeam) { RemovePlayer(player); if (newTeam == GameTeam.Assassins) { player.CharacterClass = ObjectCache.Instance.GetAssassinClass(); } else if (newTeam == GameTeam.Knights) { player.CharacterClass = ObjectCache.Instance.GetKnightClass(); } AddPlayer(player); } } else { if (newTeam == GameTeam.Assassins) { player.CharacterClass = ObjectCache.Instance.GetAssassinClass(); } else if (newTeam == GameTeam.Knights) { player.CharacterClass = ObjectCache.Instance.GetKnightClass(); } AddPlayer(player); } }
public RoomBattleBanzaiTileStateUpdate(int x, int y, GameTeam gameTeam) { this.X = x; this.Y = y; this.GameTeam = gameTeam; }