added base team class

This commit is contained in:
DerTyp187
2021-10-19 07:26:40 +02:00
parent c5162f3082
commit add5beeb47
5 changed files with 64 additions and 9 deletions

View File

@@ -5,9 +5,21 @@ using UnityEngine;
public class GameMaster : MonoBehaviour
{
[Header("GameMaster")]
[SerializeField] private int[] scores;
[SerializeField] private List<Team> teams = new List<Team>();
private void Start()
{
CreateTeam("Orange");
CreateTeam("Blue");
}
private void CreateTeam(string name, int score = 0)
{
Team team = new Team(name, score);
teams.Add(team);
}
public List<Team> GetTeams()
{
return teams;
}
}

View File

@@ -6,18 +6,20 @@ public class ServerPlayer
{
public GameObject Player;
public bool isAlive;
public Team team;
private int health;
private int kills;
private int deaths;
private const int defaultHp = 100;
public ServerPlayer(GameObject _Player, bool _isAlive = true, int _health = defaultHp, int _kills = 0, int _deaths = 0)
public ServerPlayer(GameObject _Player, bool _isAlive = true, int _health = defaultHp, int _kills = 0, int _deaths = 0, Team _team = null)
{
Player = _Player;
isAlive = _isAlive;
health = _health;
kills = _kills;
deaths = _deaths;
team = _team;
}
public void Respawn()

View File

@@ -0,0 +1,22 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Team
{
private string name;
private int score;
public Team(string _name, int _score)
{
name = _name;
score = _score;
Debug.Log(name + " Team Created!");
}
public string GetTeamName()
{
return name;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 37af856235eb74b41b53469dba1669e9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: