Exemplo n.º 1
0
 void OnTriggerExit(Collider other)
 {
     this.other = null;
     if (other.tag == Player)
     {
         mob = false;
     }
     if (other.tag == "Provodnik")
     {
         pr = null;
     }
 }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        //nma.SetDestination (trn.position);


        ShowCurrentHealth(curHealth);
        if (curHealth == 0)
        {
            nma.enabled = false;
            //Destroy (mab.gameObject);
        }
        if (curHealth == -1)
        {
            Destroy(gameObject);
        }

        if (mob)
        {
            if (Input.GetKeyDown(KeyCode.B))                // при нажатии на tab наш инвентарь будет открываться и закрываться
            {
                curHealth -= 1;
            }
        }

        if (other != null)
        {
            //print(other.name);
            if (other.tag == Player)
            {
                mob = true;
                hp  = other.GetComponent <HP>();
                if (Time.time - t > tim)               // алгоритм задержки между отниманием жизней
                {
                    hp.curHealth -= uron;              // сам процесс нанесения урона
                    t             = Time.time;         // завершение задержки
                }
            }
            if (other.tag == "Provodnik")
            {
                pr         = GetComponent <AIprovod>();
                pr.curprn -= 5;
            }
        }
    }