Example #1
0
    private void OnTriggerEnter(Collider other)
    {
        SmellAspect aspect = other.GetComponent <SmellAspect>();

        //Check if object has a smell aspect
        if (aspect != null)
        {
            //Check if agent is not an herb worm
            if (aspect.aspect != Aspect.AspectName.Herbworm)
            {
                aspect.isPoopedOn = true; //turn on smell status of agent covered in poop
                other.GetComponent <Renderer>().sharedMaterial = mat;
                Destroy(this.gameObject); //Destroy itself
            }
        }
    }
Example #2
0
    private void OnTriggerEnter(Collider other)
    {
        SmellAspect aspect = other.gameObject.GetComponent <SmellAspect>();

        //Check if object hasa smell aspect
        if (aspect != null)
        {
            //Check if Agent is covered in poop
            if (aspect.isPoopedOn)
            {
                other.gameObject.SetActive(false);
                //transition to Grow state
                //parentAnim.SetTrigger("Grow");
            }
        }
    }
Example #3
0
    /// <summary>
    /// Smells a given area and detect if a nearby agent has poo on them
    /// </summary>
    public void PooSmellDetection()
    {
        RaycastHit hit;

        if (Physics.SphereCast(this.transform.position, smellWidthRadius, this.transform.forward, out hit, smellDistance))
        {
            SmellAspect aspect = hit.transform.gameObject.GetComponent <SmellAspect>();
            if (aspect != null)
            {
                if (aspect.isPoopedOn)
                {
                    //Set the position of the
                    foodAgent = hit.transform.gameObject;
                    //transition to Prey State
                    anim.SetBool("SmellsPoo", true);
                }
            }
        }
    }