Beispiel #1
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.CompareTag("Person"))
     {
         people         = other.GetComponentInParent <PatrolPeople>();
         peopleInteract = other.GetComponentInParent <InteractBuy>();
         people.stopPath();
         if (peopleInteract.CanBuy)
         {
             isTalking = true;
             GameManager.instance.SetInteractText("Presiona 'E' para interactuar", true);
         }
         else
         {
             if (GameControl.instance.Charity)
             {
                 GameManager.instance.SetInteractText("No tengo", true);
             }
             else
             {
                 GameManager.instance.SetInteractText("No, gracias", true);
             }
         }
     }
     else if (other.gameObject.CompareTag("Enemy"))
     {
         enemy = other.GetComponentInParent <Patrol>();
         if (enemy.canFollow)
         {
             enemyArrest = other.GetComponent <InteractArrest>();
             openArrestDialog();
         }
     }
 }
Beispiel #2
0
    void SpawnPeople()
    {
        int        spawnPointIndex = Random.Range(0, SpawnPointsPeople.Count);
        GameObject people          = Instantiate(People, SpawnPointsPeople[spawnPointIndex].position,
                                                 SpawnPointsPeople[spawnPointIndex].rotation);

        // set variables of people
        PatrolPeople peoplePatrol = people.GetComponent <PatrolPeople>();
        InteractBuy  interactBuy  = people.GetComponentInChildren <InteractBuy>();

        interactBuy.setItemWantToBuy(itemsToPick[Random.Range(0, itemsToPick.Length)]);

        if (!GameControl.instance.Charity && !WantBuy())
        {
            interactBuy.WantBuy(false);
        }
        else if (GameControl.instance.Charity)
        {
            interactBuy.WantBuy(false);
            interactBuy.CanBuy = true;
        }

        peoplePatrol.moveSpots = GameManager.instance.MoveSpots;
        peoplePatrol.startPatrol();
    }
Beispiel #3
0
    void resetBehaviour()
    {
        if (people != null && peopleInteract != null)
        {
            people.continuePath();
            people         = null;
            peopleInteract = null;
        }

        charityValue = 0;
        isTalking    = false;
        GameManager.instance.SetInteractText("", false);
    }