Exemplo n.º 1
0
        //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();
            }
        }
Exemplo n.º 2
0
 //
 public void RequestSpawn(Artillery _Requestee)
 {
     if (_Requestee != null)
     {
         CallRequests.Enqueue(_Requestee);
     }
 }
Exemplo n.º 3
0
 //
 void ResetSpawner()
 {
     CurrentRequestee             = null;
     DropPointLocation            = null;
     DropPointLocationSpawnCentre = null;
     CrewMemberSpawnLocations     = null;
     CurrentStatus = ASMStatus.Inactive;
 }
Exemplo n.º 4
0
 //
 public void CallAnimateGunSpawnIn(Artillery _OwnerGC, Node _SpawnLocation)
 {
     OwnerGC = _OwnerGC;
     if (_SpawnLocation != null && OwnerGC != null)
     {
         gameObject.SetActive(true);
         StartCoroutine(AnimateGunSpawnIn(_SpawnLocation));
     }
 }
Exemplo n.º 5
0
 //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));
     }
 }
Exemplo n.º 6
0
        //
        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;
            }
        }
Exemplo n.º 7
0
        //
        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);
                }
            }
        }
Exemplo n.º 8
0
        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");
                }
            }
        }
Exemplo n.º 9
0
 // Setsup Components
 public void SetupGunCrewMember(Artillery _OwnerGC)
 {
     OwnerGC = _OwnerGC;
 }