Beispiel #1
0
    /// <summary>
    /// Updates the Current Target if Not Locked
    /// </summary>
    void UpdateTarget()
    {
        if (_Target == null || !_Target.Active && !_Target.Locked)
        {
            ////debug.log("UPDATING...");

            // Check for New Target
            AbstractEntity entity = FindTarget();
            if (entity != _Target)
            {
                // Hide Old Target
                if (_Target != null && _Target.enabled && HideTarget != null)
                    _Target.StartCoroutine(HideTarget(_Target));

                // Update Target
                _Target = entity;

                // Show New Target
                if (_Target != null && _Target.enabled && ShowTarget != null)
                    _Target.StartCoroutine(ShowTarget(_Target));
            }

        }
    }
Beispiel #2
0
    public IEnumerator TurnOn(AbstractEntity argTarget)
    {
        if (argTarget != null)
        {
            if (argTarget.enabled && HideTarget != null)
                argTarget.StartCoroutine(HideTarget(_Target));

            /// Call Delegate
            if (PowerOn != null)
            {
                argTarget.Locked = true;
                yield return argTarget.StartCoroutine(PowerOn(argTarget));
                argTarget.Locked = false;

            }

            // If No Associated Methods, Unchoose Immediately
            if (PowerOff == null)
                yield return StartCoroutine(TurnOff(argTarget));
        }
    }