Esempio n. 1
0
 void Chase()
 {
     anim.SetBool("Run", true);
     agent.SetDestination(Player.transform.position);
     if (Vector3.Distance(Fett.transform.position, Player.transform.position) < 2f)
     {
         audios.clip = punchSound;
         audios.Play();
         Values.ChangePlayerHealth(-20);
         chasing = false;
         agent.SetDestination(points[destPoint].position);
     }
 }
Esempio n. 2
0
 void OnTriggerEnter(Collider col)
 {
     if (col.gameObject.tag == "Player")
     {
         Values.ChangePlayerHealth(trapDamage + 10);
         trigger.Play();
     }
     else if (col.gameObject.tag == "Enemy")
     {
         Values.ChangeFettHealth(trapDamage);
         trigger.Play();
     }
 }
Esempio n. 3
0
 void OnTriggerEnter(Collider col)
 {
     if (col.gameObject.tag == "Player")
     {
         Values.ChangePlayerHealth(wireDamage + 15);
         explode.Play();
         gameObject.transform.GetChild(0).gameObject.SetActive(false);
     }
     else if (col.gameObject.tag == "Enemy")
     {
         Values.ChangeFettHealth(wireDamage);
         explode.Play();
         gameObject.transform.GetChild(0).gameObject.SetActive(false);
     }
 }
Esempio n. 4
0
    public void OnTriggerStay(Collider collider)
    {
        switch (collider.gameObject.tag)
        {
        case "Note":
            Message.SetActive(true);
            if (Input.GetKey("e"))
            {
                FoundNotes[numberOfNotes] = collider.name;
                NoteButtons[numberOfNotes].SetActive(true);
                numberOfNotes++;
                Destroy(collider.gameObject);
            }
            break;

        case "Ammo":
            Message.SetActive(true);
            if (Input.GetKey("e"))
            {
                Destroy(collider.gameObject);
                Values.AddAmmo();
            }
            break;

        case "Medpack":
            Message.SetActive(true);
            if (Input.GetKey("e"))
            {
                Destroy(collider.gameObject);
                Values.ChangePlayerHealth(100);
            }
            break;

        case "Trap":
            Message.SetActive(true);
            if (Input.GetKey("e"))
            {
                Destroy(collider.gameObject);
                Values.AddTrap();
            }
            break;

        case "Can":
            Message.SetActive(true);
            if (Input.GetKey("e"))
            {
                Destroy(collider.gameObject);
                Values.AddCan();
            }
            break;

        case "Rope":
            Message.SetActive(true);
            if (Input.GetKey("e"))
            {
                Destroy(collider.gameObject);
                Values.AddRope();
            }
            break;

        case "Stick":
            Message.SetActive(true);
            if (Input.GetKey("e"))
            {
                Destroy(collider.gameObject);
                Values.AddStick();
            }
            break;

        case "SpotTrap":
            BuildingMessage.SetActive(true);
            if (Values.CanPlaceTrap())
            {
                BuildingMessage.GetComponent <Text>().text = "Press 'E' to place";
                if (Input.GetKey("e"))
                {
                    Values.tripwire.Place(collider.gameObject.transform.parent.gameObject);
                }
            }
            else
            {
                BuildingMessage.GetComponent <Text>().text = "Not enough items to place";
            }
            break;
        }
    }