mirror of
https://github.com/DerTyp7/defrain-shooter-unity.git
synced 2025-10-29 12:52:07 +01:00
added base team class
This commit is contained in:
@@ -38,7 +38,7 @@ RenderSettings:
|
|||||||
m_ReflectionIntensity: 1
|
m_ReflectionIntensity: 1
|
||||||
m_CustomReflection: {fileID: 0}
|
m_CustomReflection: {fileID: 0}
|
||||||
m_Sun: {fileID: 705507994}
|
m_Sun: {fileID: 705507994}
|
||||||
m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1}
|
m_IndirectSpecularColor: {r: 0.44657826, g: 0.49641263, b: 0.57481676, a: 1}
|
||||||
m_UseRadianceAmbientProbe: 0
|
m_UseRadianceAmbientProbe: 0
|
||||||
--- !u!157 &3
|
--- !u!157 &3
|
||||||
LightmapSettings:
|
LightmapSettings:
|
||||||
@@ -1074,6 +1074,7 @@ GameObject:
|
|||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 1067101117}
|
- component: {fileID: 1067101117}
|
||||||
- component: {fileID: 1067101118}
|
- component: {fileID: 1067101118}
|
||||||
|
- component: {fileID: 1067101119}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: GameManager
|
m_Name: GameManager
|
||||||
m_TagString: GameController
|
m_TagString: GameController
|
||||||
@@ -1107,12 +1108,19 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: cb5ee5f3d2923ee4faeaf50ed35ab2f5, type: 3}
|
m_Script: {fileID: 11500000, guid: cb5ee5f3d2923ee4faeaf50ed35ab2f5, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
Players: []
|
|
||||||
Health:
|
|
||||||
Kills:
|
|
||||||
Deaths:
|
|
||||||
defaultHp: 100
|
|
||||||
TestPlayer: {fileID: 1187582346}
|
TestPlayer: {fileID: 1187582346}
|
||||||
|
--- !u!114 &1067101119
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1067101116}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 26ee7b094ee25bf49aaf5ffba35f8cf6, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
--- !u!1 &1111479331 stripped
|
--- !u!1 &1111479331 stripped
|
||||||
GameObject:
|
GameObject:
|
||||||
m_CorrespondingSourceObject: {fileID: 2550463727306718371, guid: 823e8b39d52b71b4eb5a91dbc8d6d59e, type: 3}
|
m_CorrespondingSourceObject: {fileID: 2550463727306718371, guid: 823e8b39d52b71b4eb5a91dbc8d6d59e, type: 3}
|
||||||
|
|||||||
@@ -5,9 +5,21 @@ using UnityEngine;
|
|||||||
public class GameMaster : MonoBehaviour
|
public class GameMaster : MonoBehaviour
|
||||||
{
|
{
|
||||||
[Header("GameMaster")]
|
[Header("GameMaster")]
|
||||||
[SerializeField] private int[] scores;
|
[SerializeField] private List<Team> teams = new List<Team>();
|
||||||
private void Start()
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,18 +6,20 @@ public class ServerPlayer
|
|||||||
{
|
{
|
||||||
public GameObject Player;
|
public GameObject Player;
|
||||||
public bool isAlive;
|
public bool isAlive;
|
||||||
|
public Team team;
|
||||||
private int health;
|
private int health;
|
||||||
private int kills;
|
private int kills;
|
||||||
private int deaths;
|
private int deaths;
|
||||||
private const int defaultHp = 100;
|
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;
|
Player = _Player;
|
||||||
isAlive = _isAlive;
|
isAlive = _isAlive;
|
||||||
health = _health;
|
health = _health;
|
||||||
kills = _kills;
|
kills = _kills;
|
||||||
deaths = _deaths;
|
deaths = _deaths;
|
||||||
|
team = _team;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Respawn()
|
public void Respawn()
|
||||||
|
|||||||
22
Assets/Scripts/GameManager/Team.cs
Normal file
22
Assets/Scripts/GameManager/Team.cs
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/GameManager/Team.cs.meta
Normal file
11
Assets/Scripts/GameManager/Team.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 37af856235eb74b41b53469dba1669e9
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Reference in New Issue
Block a user