예제 #1
0
 void Awake()
 {
     piglet      = transform.parent.GetComponent <Piglet>();
     farmer      = GameObject.Find("Farmer").GetComponent <Farmer>();
     source      = gameObject.GetComponent <AudioSource>();
     source.clip = clip;
 }
예제 #2
0
 private void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.CompareTag("piglet"))
     {
         if (IsBeast && !IsKilling)
         {
             _touchedPiglet             = collision.gameObject.GetComponent <Piglet>();
             _touchedPiglet.Rb.velocity = Vector3.zero;
             _touchedPiglet.Rb.drag     = Mathf.Infinity;
             _rigidbody.drag            = Mathf.Infinity;
             AnimatorIdle();
             purge();
         }
     }
 }
예제 #3
0
    private void OnTriggerEnter(Collider col)
    {
        if (col.gameObject.tag == "cultist")
        {
            Cultist cultist = col.gameObject.GetComponent <Cultist>();
            if (cultist.IsBeast)
            {
                //_agent.speed = 11;


                //Couroutine To Play Death Animation

                cultist.IsDying             = true;
                cultist._rigidbody.velocity = Vector3.zero;
                cultist.IsBeast             = false;
                //cultist.Marker.sprite = null;
                if (cultist.IsKilling)
                {
                    Piglet piglet = cultist._touchedPiglet;
                    piglet.Rb.velocity =
                        new Vector3(Random.Range(-1f, 1f), 0, Random.Range(-1f, 1f)).normalized *piglet._vel;
                    piglet.Rb.drag = 0;
                    foreach (TextMeshProUGUI txt in cultist.Text)
                    {
                        txt.text = "";
                    }

                    foreach (Animator animator in cultist.ButtonAnimators)
                    {
                        animator.SetBool("Active", false);
                    }
                }
                StartCoroutine(cultist.PlayDeathAnimation());
            }
            //  }
            // --
            //else
            // Load Win screen scene
        }
    }