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);
         }
     }
 }
Exemple #2
0
        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();
            }
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        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);
        }
Exemple #5
0
        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();
        }
Exemple #6
0
 void TryKillChicken(Recruitable r)
 {
     KillChicken(r);
 }
Exemple #7
0
 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
 }
Exemple #9
0
 void OnNir(Recruitable r)
 {
     ChickensSaved++;
     TotalPointsWon += r.GetComponent <ChickenProperties>().Points;
     Debug.Log("chickens: " + ChickensSaved + "  points total:" + TotalPointsWon);
 }