//Yeah could be moved into a switch and then a shift call could be made to move onto the next step... IEnumerator ProcessSpaqnRequest(Artillery _Requestee) { CurrentRequestee = _Requestee; CurrentStatus = ASMStatus.SearchingForDropZone; ScanForDropZone(); yield return(new WaitUntil(() => CurrentRequestee.CurrentSpawnStatus == ArtillerySpawnStatus.GunDropPointFound)); if (DropPointLocation != null && DropPointLocationSpawnCentre != null) { CurrentStatus = ASMStatus.SpawningGun; DropInGun(_Requestee); yield return(new WaitUntil(() => CurrentRequestee.CurrentSpawnStatus == ArtillerySpawnStatus.GunLanded)); } if (CurrentRequestee.CurrentSpawnStatus == ArtillerySpawnStatus.GunLanded) { CurrentStatus = ASMStatus.SpawningCrew; DropInGunCrew(_Requestee); yield return(new WaitUntil(() => CurrentRequestee.CurrentSpawnStatus == ArtillerySpawnStatus.CrewLanded)); } if (CheckSpawnIsCompleate()) { CurrentStatus = ASMStatus.CleaningUp; CurrentRequestee.CurrentSpawnStatus = ArtillerySpawnStatus.Ready; ResetSpawner(); } }
// public void RequestSpawn(Artillery _Requestee) { if (_Requestee != null) { CallRequests.Enqueue(_Requestee); } }
// void ResetSpawner() { CurrentRequestee = null; DropPointLocation = null; DropPointLocationSpawnCentre = null; CrewMemberSpawnLocations = null; CurrentStatus = ASMStatus.Inactive; }
// public void CallAnimateGunSpawnIn(Artillery _OwnerGC, Node _SpawnLocation) { OwnerGC = _OwnerGC; if (_SpawnLocation != null && OwnerGC != null) { gameObject.SetActive(true); StartCoroutine(AnimateGunSpawnIn(_SpawnLocation)); } }
//Calls the spawn in and allows the GCM to do it's own thing. public void CallAnimateSpawnIn(Artillery _OwnerGC, Node _SpawnLocation) { SetupGunCrewMember(_OwnerGC); if (_SpawnLocation != null && OwnerGC != null) { gameObject.SetActive(true); StartCoroutine(AnimateSpawnIn(_SpawnLocation)); } }
// void DropInGun(Artillery _requestee) { if (DropPointLocation != null && DropPointLocationSpawnCentre != null) { Node SpawnNode = DropPointLocationSpawnCentre; CurrentRequestee.SpawnNode = DropPointLocationSpawnCentre; FieldGun NewFG = Instantiate(FieldGunPrefab, CurrentRequestee.transform).GetComponent <FieldGun>();; NewFG.CallAnimateGunSpawnIn(_requestee, SpawnNode); _requestee.FieldGun = NewFG; } }
// void DropInGunCrew(Artillery _requestee) { _requestee.CrewMembers = new GunCrewMember[4]; if (_requestee.CurrentSpawnStatus == ArtillerySpawnStatus.GunLanded) { for (int CrewMemberIndex = 0; CrewMemberIndex < _requestee.CrewMembers.Length; ++CrewMemberIndex) { int RandInt = Random.Range(0, CrewMemberSpawnLocations.Count); Node SpawnNode = CrewMemberSpawnLocations[RandInt]; GunCrewMember NewCrew = Instantiate(GunCrewMemberPrefab, _requestee.transform).GetComponent <GunCrewMember>(); _requestee.CrewMembers[CrewMemberIndex] = NewCrew; NewCrew.CallAnimateSpawnIn(_requestee, SpawnNode); CrewMemberSpawnLocations.RemoveAt(RandInt); } } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); Artillery TargetTestGunCrewAI = (Artillery)target; if (GUILayout.Button("Request GunSpawn")) { if (NodeManager.Instance.SetupCompletate) { TargetTestGunCrewAI.RequestSpawnIn(); } else { Debug.Log("Wait for NodeManager Setup is compleate"); } } }
// Setsup Components public void SetupGunCrewMember(Artillery _OwnerGC) { OwnerGC = _OwnerGC; }