public void RpcChangePointState(int pointID, CovertPointStatus newState, PhotonMessageInfo info) { Team team = info.Sender.GetPlayerTeam(); if (newState == CovertPointStatus.Taking) { objetivePoints[pointID].AddPlayerInPoint(info.Sender); //add this player at this point if (!objetivePoints[pointID].CanTakePoint(team)) //if the point is from the enemy team and it doesn't have any member of the that team { newState = CovertPointStatus.Contested; //members of both team inside } objetivePoints[pointID].CheckNewEntrance(info.Sender, newState); //check how the point will react with this new player entrance } else if (newState == CovertPointStatus.Eviction) //player leave or die inside of point { if (objetivePoints[pointID].RemovePlayerFromPoint(info.Sender)) //if no one remain inside of the point { if (objetivePoints[pointID].TeamOwner == Team.None) //if no one have controlled this point before { newState = CovertPointStatus.Untaked; } else { newState = CovertPointStatus.Taked; } } objetivePoints[pointID].CheckExit(info.Sender);//check how the point will react with this new player exit } objetivePoints[pointID].SetStatus(newState, team); }
public void SetStatus(CovertPointStatus newStatus, Team team) { if (pointStatus == CovertPointStatus.Taked && newStatus == CovertPointStatus.Taking && team == TeamOwner) { return; //don't change the taken status if a player from the dominate team entry in the point } pointStatus = newStatus; }
public void CheckNewEntrance(Player player, CovertPointStatus newStatus) { if (pointStatus != CovertPointStatus.Taking && newStatus == CovertPointStatus.Taking)//someone start taking this point { if (TeamOwner == player.GetPlayerTeam()) { return; } pointBase.StartTakingThisPoint(player.GetPlayerTeam()); } else if (pointStatus == CovertPointStatus.Taking && newStatus == CovertPointStatus.Contested)//someone of the enemy team get in the point. { pointBase.StopTaking(); } }