2022-05-30 14:12:04 +02:00
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
public class Communication : MonoBehaviour
|
|
|
|
|
{
|
2022-05-30 15:02:13 +02:00
|
|
|
public struct CommunicationResult
|
|
|
|
|
{
|
|
|
|
|
public bool resetTTL;
|
|
|
|
|
public List<Soldier> enemiesSpotted;
|
|
|
|
|
}
|
2022-05-30 14:12:04 +02:00
|
|
|
|
2022-05-30 15:02:13 +02:00
|
|
|
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;
|
|
|
|
|
}
|
2022-05-30 14:12:04 +02:00
|
|
|
}
|