merloj: Communication class base

- also deleted unused Box Collider from Soldier prefab
This commit is contained in:
Maciekxdabu 2022-05-30 15:02:13 +02:00
parent f20a5b1e71
commit e627369767
2 changed files with 55 additions and 14 deletions

View File

@ -9,9 +9,9 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 430939372503899243}
- component: {fileID: 2567001691605468863}
- component: {fileID: 9215955991629613539}
- component: {fileID: 1033819704020761458}
- component: {fileID: 7079878905123983671}
m_Layer: 0
m_Name: Soldier
m_TagString: 'Ally '
@ -37,19 +37,6 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
--- !u!65 &2567001691605468863
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 403095692180922766}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 0
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!54 &9215955991629613539
Rigidbody:
m_ObjectHideFlags: 0
@ -97,6 +84,18 @@ MonoBehaviour:
enemyType: 0
movementDestination: {x: 0, y: 0}
hasReachedDestination: 1
--- !u!114 &7079878905123983671
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 403095692180922766}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 531947a4f2c9d414880a0f04ecd2c970, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1997457243244158843
GameObject:
m_ObjectHideFlags: 0

View File

@ -4,5 +4,47 @@ using UnityEngine;
public class Communication : MonoBehaviour
{
public struct CommunicationResult
{
public bool resetTTL;
public List<Soldier> enemiesSpotted;
}
private float viewRange = 5f;
private Soldier mySoldier = null;
private Entity.Team myTeam = Entity.Team.Ally;
// ---------- public methods
public void Initialize(float _viewRange, Soldier _mySoldier, Entity.Team _myTeam)
{
viewRange = _viewRange;
mySoldier = _mySoldier;
myTeam = _myTeam;
}
public CommunicationResult HandleCommuncation()
{
CommunicationResult result = new CommunicationResult();
result.resetTTL = false;
result.enemiesSpotted = new List<Soldier>();
// look for soldiers in vincinity
// send Keep Alive (myTeam) - reset TTL (myTTL)
// look fo enemies (enemyTeam) - add Enemies to enemiesSpotted (send List<Enemies>)
return result;
}
// ---------- private methods
private Soldier[] GetSoldiersInVincinity()
{
//TO DO - implement
Physics.SphereCastAll()
return null;
}
}