예제 #1
0
    public void DestroySheep(Script_Sheep p_sheep, Material p_material)
    {
        GameObject sheepObject = p_sheep.GetSheepObject();

        _sheepList.Remove(p_sheep);
        _gameManager.DestroyObject(sheepObject);
        _gameManager.DestroyMaterial(p_material);
    }
예제 #2
0
    private void EatSheep()
    {
        float feedingHealthIncrease = 0.07f;
        float damage = 0.2f;


        if (_sheepBeingEaten != null && _sheepBeingEaten.GetSheepObject() != null)
        {
            _wolfObject.transform.position += (_sheepBeingEaten.GetPosition() - _wolfObject.transform.position).normalized * _speed;
            _health += feedingHealthIncrease;
            _health  = Mathf.Clamp(_health, 0, _maxHealth);
            if (_sheepBeingEaten != null)
            {
                _sheepBeingEaten.DecreaseHealth(damage);
            }
        }
        else
        {
            _health -= _actionDecay;
        }
    }