private void ClearSquad() { SquadLeader = ""; InvitedSquadMembers.Clear(); SquadMembers.Clear(); Loot.Clear(); SquadActive = false; IsCancelled = false; DeleteFile(); }
public void UpdateSquadMembers() //updates members and sets up manager { SquadMembers.Clear(); GameObject squadParent = null; float squadSpeedTemp = 100000f; //declare a temp speed foreach (var go in GetComponentsInChildren <Transform>()) { if (go.name == "SquadMembers") { squadParent = go.gameObject; } } foreach (var member in squadParent.GetComponentsInChildren <Transform>()) { if (member.GetComponent <SquadMemberManager>() != null) { SquadMembers.Add(member.gameObject); } } int i = 0; foreach (var member in SquadMembers) //search for slowest man in squaad and setup members { SquadMemberManager memberManager = member.GetComponent <SquadMemberManager>(); if (memberManager.speed < squadSpeedTemp) //is it slower than others? { squadSpeedTemp = memberManager.speed; } memberManager.SetPlaceholder(Placeholders[i]); //set default positin memberManager.GoPosition(); //send him to position memberManager.Team = Team; memberManager.SetMyManager(gameObject); //set his manager i++; } SetSquadSpeed(squadSpeedTemp); //set everyones speed to slowest man in squad SetSquadTeam(Team); manCount = squadMembers.Count; Alive = true; }