public void CaptureCow(GameObject cow) { CowController captueredCow = cow.GetComponent <CowController>(); CapturedCows.Push(captueredCow.cow); Destroy(cow); GameObject.FindWithTag(TagConstants.MissionStatus).GetComponent <MissionStatus>().UpdateInventoryCow(captueredCow.cow); }
public void ThrowBackCow(Vector3 throwbackSpot) { if (CapturedCows.Count == 0) { return; } Cow throwBack = CapturedCows.Pop(); throwBack.spawnLocation = throwbackSpot; Cow nextCow = CapturedCows.Count == 0 ? null : CapturedCows.Peek(); GameObject.FindWithTag(TagConstants.MissionStatus).GetComponent <MissionStatus>().UpdateInventoryCow(nextCow); SpawnCow(throwBack, GameObject.FindWithTag(TagConstants.Pasture)); }