Esempio n. 1
0
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag(_bulletTag))
        {
            BulletBehaviour bulletCB = other.GetComponent <BulletBehaviour>();

            if (bulletCB.CanBePicked() && _energyHandler.GetPlayerEnergyAmount() < Global.Player[(int)_playerController.Index].HealthController.GetCurHealth())
            {
                CollectEnergy(bulletCB);
            }
            else if (bulletCB.CanBePicked() == false && bulletCB.GetOwnerId() != (int)_playerController.Index)
            {
                KillPlayer();
            }
        }

        if (other.gameObject.CompareTag("Limiter"))
        {
            transform.position = _initialPos;
        }
    }
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag(_energyTag))
        {
            BulletBehaviour bulletCB = other.GetComponent <BulletBehaviour>();

            if (bulletCB.CanBePicked() && _energyHandler.GetPlayerEnergyAmount() < GameLoop.MAX_ENERGY)
            {
                CollectEnergy(bulletCB);
            }
            else if (bulletCB.CanBePicked() == false)
            {
                KillPlayer();
            }
        }

        if (other.gameObject.CompareTag("Limiter"))
        {
            transform.position = _initialPos;
        }
    }