Esempio n. 1
0
    IEnumerator InteractionBool()
    {
        m_camMovement.Interact(true);
        m_pad.Interactions("Interaction");
        m_deCounter = 0.0f;
        yield return(new WaitForSeconds(2));

        m_actionHappening = false;
        m_inter           = false;
        m_camMovement.Interact(false);
    }
Esempio n. 2
0
    void Update()
    {
        if (Input.GetMouseButton(0))
        {
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;
            if (Physics.Raycast(ray, out hit))
            {
                if (hit.collider.name == "Food")
                {
                    m_food    = true;
                    m_notFood = m_water = m_notWater = m_clean = m_notClean = false;

                    for (int i = 0; i < m_nodebool.Length; i++)
                    {
                        m_nodebool[i] = false;
                    }
                }
                else if (hit.collider.name == "Water")
                {
                    m_water   = true;
                    m_notFood = m_food = m_notWater = m_clean = m_notClean = false;

                    for (int i = 0; i < m_nodebool.Length; i++)
                    {
                        m_nodebool[i] = false;
                    }
                }
                else if (hit.collider.name == "Clean")
                {
                    m_clean   = true;
                    m_notFood = m_water = m_notWater = m_food = m_notClean = false;

                    for (int i = 0; i < m_nodebool.Length; i++)
                    {
                        m_nodebool[i] = false;
                    }
                }
                else if (hit.collider.name == this.name)
                {
                    if (m_inter == false)
                    {
                        m_inter = true;
                        m_pad.Interactions("Interaction");
                        Debug.Log("INTER");
                        m_deCounter = 0.0f;
                        StartCoroutine(InteractionBool());
                    }
                }
            }
        }

        if (m_deCounter >= m_deTimer)
        {
            m_deCounter = 0.0f;
            Debug.Log("NO INTER");
            m_pad.NoInteractions("No Interaction");
        }

        m_deCounter += Time.deltaTime;

        if (m_food)
        {
            MoveToFood();
        }
        else if (m_notFood)
        {
            MoveFromFood();
        }
        else if (m_water)
        {
            MoveToWater();
        }
        else if (m_notWater)
        {
            MoveFromWater();
        }
        else if (m_clean)
        {
            MoveToClean();
        }
        else if (m_notClean)
        {
            MoveFromClean();
        }
    }