void OnTriggerEnter(Collider other) { if (other.GetComponent <Recruitable>() != null) //it's a recruit { Recruitable chicken = other.GetComponent <Recruitable>(); if (Events.Recruitment.KillChicken != null) { Events.Recruitment.KillChicken(chicken); } } }
void OnRecruitmentResult(Recruitable recruitable, bool result) { Debug.Log("OnRecruitmentResult " + recruitable + " " + result); if (songObj) { LeanTween.scale(songObj, Vector3.zero, 0.5f).setEase(LeanTweenType.easeInOutQuint).setOnComplete(() => { Destroy(songObj); songObj = null; }); } if (result) { GetComponent <ChickenLine>().AddFollowingChicken(recruitable); recruitable.SetRecruited(); } }
public void StartSong(Recruitable recruitable) { if (ChickenSong.InSong) { Debug.Log("can't start song, in song"); return; } if (songObj) { Debug.Log("can't start song, already one"); return; } songObj = Instantiate(songPrefab, songPosition, Quaternion.identity); songObj.transform.SetParent(Camera.main.transform, false); songObj.GetComponent <ChickenSong>().GenerateAndPlaySong(recruitable); }
public void KillChicken(Recruitable recruitable) { recruitable.DidDie(); var follow = recruitable.GetComponent <VerletFollow>(); if (follow) { follow.enabled = false; } var v = recruitable.GetComponent <Verlet3D>(); if (v) { v.enabled = false; } if (featherExplosion) { Instantiate(featherExplosion, recruitable.transform.position, Quaternion.identity); } chickensFollowingYou.Remove(recruitable); }
IEnumerator ExplodeWithDelay() { ParentMine.PlayCountdownSound(); yield return(new WaitForSeconds(2.0f)); ParentMine.PlayExplosionSound(); //grab all the chickens colliding foreach (GameObject g in collidingObjects) { if (g.GetComponent <Recruitable>() != null) { //tis a chicken! Recruitable chicken = g.GetComponent <Recruitable>(); if (g.GetComponent <Rigidbody>() != null) { g.GetComponent <Rigidbody>().AddExplosionForce(ExplosiveForce, transform.position, ExplosionRadius, ExplosionUpwards); } Events.Recruitment.KillChicken(chicken); } } ParentMine.DestroyMine(); }
void TryKillChicken(Recruitable r) { KillChicken(r); }
public void AddFollowingChicken(Recruitable recruitable) { recruitable.GetComponent <Rigidbody>().isKinematic = false; chickensFollowingYou.Add(recruitable); }
void OnNirvanaReached(Recruitable recruitable) { savedChickens++; SavedCount.text = savedChickens.ToString(); //increase number of saved chickens }
void OnNir(Recruitable r) { ChickensSaved++; TotalPointsWon += r.GetComponent <ChickenProperties>().Points; Debug.Log("chickens: " + ChickensSaved + " points total:" + TotalPointsWon); }