public void ConvertBaby(GameObject preBaby) { FollowerBaby FollowBaby = Instantiate(BabyFollowerPrefab); Debug.Log(PlayerName + " hit the baby"); if (FollowBaby) { FollowBaby.SetDiaperColor(playerColor); audioSrc.clip = convertSound; audioSrc.pitch = Random.Range(.6f, 1.1f); audioSrc.volume = .2f; audioSrc.Play(); Babies.Add(FollowBaby); Babies[Babies.Count - 1].transform.position = preBaby.transform.position; FollowBaby.TargetTrans = transform; if (Babies.Count > 1) { Babies[Babies.Count - 2].TargetTrans = FollowBaby.transform; } Destroy(preBaby); } }
public void DropBabies(int babiesToDrop) { for (int i = 0; i < babiesToDrop && Babies.Any(); i++) { FollowerBaby lastBaby = Babies.First(); DropBaby(lastBaby); } }
IEnumerator SendChildGrenade() { FollowerBaby despawnedChild = Babies[0]; Babies.RemoveAt(0); if (despawnedChild) { GameObject despawnParticleEffect = Instantiate(deSpawnSmoke, despawnedChild.transform); despawnParticleEffect.transform.position = new Vector3(despawnParticleEffect.transform.position.x, 0f, despawnParticleEffect.transform.position.z); Destroy(despawnedChild.gameObject, 1f); } yield return(new WaitForSeconds(1f)); grenadeTimer = Time.timeSinceLevelLoad; atheistGrenadeBaby = Instantiate( atheistGrenadeBabyPrefab, grenadeSpawn.position, grenadeSpawn.rotation); StartCoroutine(GreenBoom()); audioSrc.clip = throwSound; audioSrc.pitch = Random.Range(.6f, 1.4f); audioSrc.volume = .6f; audioSrc.Play(); // Add velocity to the baby atheistGrenadeBaby.GetComponent <Rigidbody>().velocity = transform.forward * grenadeSpeed + transform.up * grenadeAngledForce; Physics.IgnoreCollision(atheistGrenadeBaby.GetComponent <Collider>(), GetComponent <Collider>(), true); // Destroy the bullet after 2 seconds GameObject temp = Instantiate(pentagram, grenadeSpawn.transform); temp.transform.SetParent(this.gameObject.transform); Destroy(temp, 2.0f); dontSpamPent = false; }
private void DropBaby(FollowerBaby baby) { Babies.Remove(baby); SpawnController.Instance.SpawnBaby(baby.transform.position); Destroy(baby.gameObject); }