Пример #1
0
    void Start()
    {
        navMesh = GetComponent <NavMeshAgent> ();
        aS      = GetComponent <AudioSource> ();

        skRb = GetComponent <Rigidbody> ();
        if (memento.ID != 0)
        {
            targetRubble = FindObjectOfType <RubbleManager> ();
            targetSpot   = targetRubble.GetSpotTransform();
            if (targetSpot == null)
            {
                targetSpot = Camera.main.GetComponent <skSpotManager> ().GetSpotTransform();
            }
        }
        //Invoke ("MoveToRubble", 2.0f);
    }
Пример #2
0
    }    //Check l'Input

    void OnTriggerStay(Collider other)
    {
        float distance = Vector3.Distance(other.transform.position, transform.position);

        //SPOT------------------------------------------------------------------------------------------------
        if (other.tag == "Spot" && digInput && distance < 3f)
        {
            newSpotManager = other.transform.GetComponent <SpotManager> ();
            StartCoroutine(Dig("Spot", 1.5f));
            digInput = false;
        }
        //RUBBLE----------------------------------------------------------------------------------------------
        else if (other.tag == "Rubble" && digInput && distance < 6f)
        {
            RubbleManager rubMan = other.gameObject.GetComponent <RubbleManager> ();
            if (rubMan.readyToDig)
            {
                rubMan.StartCoroutine("RubbleClear");
                PlayerController.controlsAble = false;
                anim.SetTrigger("DigTrigger");
            }
            digInput = false;
        }
        //BARIL------------------------------------------------------------------------------------------
        else if (other.tag == "Baril" && digInput && distance < 3.5f && other.GetComponent <Rigidbody>().isKinematic)
        {
            newRbBaril = other.GetComponent <Rigidbody>();
            StartCoroutine(Dig("Baril", 1f));
            digInput = false;
        }
        else if (other.tag == "Palmier" && digInput && distance < 3f)
        {
            print("nice");
            StartCoroutine(Dig("Palmier", 1f));
            digInput   = false;
            newPalmier = other.GetComponent <PalmiersScripts> ();
        }
    }