Example #1
0
    public void Activate(ITargetable _target, Vector3 _dir)
    {
        float _dist = 0;

        if (_target != null)
        {
            _dist = (transform.position - _target.Position).magnitude;
        }
        if (_target != null && _target.isActivatable && _dist < _target.MinDistanceToActivate)
        {
            Ray        _ray = new Ray(transform.position, _target.Position - transform.position);
            RaycastHit _hit;
            if (!Physics.Raycast(_ray, out _hit, _dist, GameManager.CollMask))
            {
                SetExternalAction(_target.Activate(this, _dir));
            }
        }
    }