Beispiel #1
0
    public void Use(TargetableSystem target)
    {
        if (!IsTargetInRange(target))
        {
            throw new UnityException("Error -- trying to use a weapon on something that is out of its range.  This should not happen!");
        }

        onUseWeapon.Invoke(this, target);
    }
    public void SetTarget(Vector3 worldPosition)
    {
        if (targetable)
        {
            targetable.RemoveWatcher(this);
            targetable = null;
        }

        this.targetWorldPosition = worldPosition;
    }
    public void SetTarget(TargetableSystem newTarget)
    {
        if (targetable != null)
        {
            targetable.RemoveWatcher(this);
        }

        targetable = newTarget;

        newTarget.AddWatcher(this);
    }
Beispiel #4
0
 public bool IsTargetInRange(TargetableSystem target)
 {
     return(Vector3.Distance(transform.position, target.transform.position) <= weaponConfig.range);
 }