public void DeleteTeamAllUnits(E_TEAMTYPE _Type, bool _Network = true) { if (!PhotonNetwork.IsMasterClient) { return; } Character[] c = m_ListCharacters[(int)_Type].ToArray(); for (int i = 0; i < c.Length; ++i) { c[i].ObjectDestroyWithDelay(); } m_ListCharacters[(int)_Type].Clear(); }
static public Character FindTeamShape(Character _Self, E_TEAMTYPE _Team, Vector3 _Location, Vector3 _Forward, float _Radius, float _HalfAngle, bool _CheckLive = true, bool _DeadOnly = false) { Character target = null; Collider[] colls = Physics.OverlapSphere(_Location, _Radius, 1 << Common.CHARACTER_LAYER); if (colls.Length > 0) { float distance = 99999999.9f; for (int i = 0; i < colls.Length; ++i) { if (colls[i] == _Self.m_BodyCollider) { continue; } Character c = colls[i].GetComponentInParent <Character>(); if (c) { if (c.m_Team != _Team) { continue; } if (_CheckLive && c.m_Live == E_LIVE.DEAD) { continue; } if (_DeadOnly && c.m_Live != E_LIVE.DEAD) { continue; } Vector3 dir = colls[i].transform.position - _Location; float dot = Vector3.Dot(_Forward, dir.normalized); if (dot > 1.0f - _HalfAngle / 180.0f) { float sqrm = dir.sqrMagnitude; if (sqrm < distance) { target = c; distance = sqrm; } } } } } return(target); }
static public List <Character> FindTeamAllShape(Character _Self, E_TEAMTYPE _Team, Vector3 _Location, Vector3 _Forward, float _Radius, float _HalfAngle, bool _CheckLive = true, bool _DeadOnly = false) { Collider[] colls = Physics.OverlapSphere(_Location, _Radius, 1 << Common.CHARACTER_LAYER); if (colls.Length > 0) { List <Character> list = new List <Character>(); for (int i = 0; i < colls.Length; ++i) { if (colls[i] == _Self.m_BodyCollider) { continue; } Character c = colls[i].GetComponentInParent <Character>(); if (c) { if (c.m_Team != _Team) { continue; } if (_CheckLive && c.m_Live == E_LIVE.DEAD) { continue; } if (_DeadOnly && c.m_Live != E_LIVE.DEAD) { continue; } Vector3 dir = colls[i].transform.position - _Location; float dot = Vector3.Dot(_Forward, dir.normalized); if (dot > 1.0f - _HalfAngle / 180.0f) { list.Add(c); } } } if (list.Count < 1) { return(null); } return(list); } return(null); }
static public List <Character> FindTeamAllArea(Character _Self, E_TEAMTYPE _Team, Vector3 _Location, float _Radius, bool _OthersOnly = true, bool _CheckLive = true, bool _DeadOnly = false) { Collider[] colls = Physics.OverlapSphere(_Location, _Radius, 1 << Common.CHARACTER_LAYER); if (colls.Length > 0) { List <Character> list = new List <Character>(); for (int i = 0; i < colls.Length; ++i) { if (_OthersOnly && colls[i] == _Self.m_BodyCollider) { continue; } Character c = colls[i].GetComponentInParent <Character>(); if (c) { if (c.m_Team != _Team) { continue; } if (_CheckLive && c.m_Live == E_LIVE.DEAD) { continue; } if (_DeadOnly && c.m_Live != E_LIVE.DEAD) { continue; } list.Add(c); } } if (list.Count < 1) { return(null); } return(list); } return(null); }
static public int ScopeTeamCheck(Character _Self, E_TEAMTYPE _Team, Vector3 _Location, float _Radius, bool _CheckLive = true, bool _DeadOnly = false) { Collider[] colls = Physics.OverlapSphere(_Location, _Radius, 1 << Common.CHARACTER_LAYER); int count = 0; if (colls.Length > 0) { for (int i = 0; i < colls.Length; ++i) { if (colls[i] == _Self.m_BodyCollider) { continue; } Character c = colls[i].GetComponentInParent <Character>(); if (c) { if (c.m_Team != _Team) { continue; } if (_CheckLive && c.m_Live == E_LIVE.DEAD) { continue; } if (_DeadOnly && c.m_Live != E_LIVE.DEAD) { continue; } count++; } } } return(count); }
public List <Character> GetTeamUnits(E_TEAMTYPE _Type) { return(m_ListCharacters[(int)_Type]); }
public void RemoveTeamUnit(E_TEAMTYPE _Type, Character _Character) { m_ListCharacters[(int)_Type].Remove(_Character); }
public void InsertTeamUnit(E_TEAMTYPE _Type, Character _Character) { m_ListCharacters[(int)_Type].Add(_Character); }