Beispiel #1
0
        /// <summary>
        /// Activates the action on a single target
        /// </summary>
        /// <param name="rTarget">Target to activate on</param>
        protected bool ActivateInstance(GameObject rTarget)
        {
            if (rTarget == null) { return false; }

            IAttributeSource lAttributeSource = rTarget.GetComponent<IAttributeSource>();
            if (lAttributeSource == null) { return false; }

            if (!lAttributeSource.AttributeExists(AttributeName)) { return false; }

            return true;
        }
Beispiel #2
0
        /// <summary>
        /// Activates the action on a single target
        /// </summary>
        /// <param name="rTarget">Target to activate on</param>
        protected bool ActivateInstance(GameObject rTarget)
        {
            if (rTarget == null)
            {
                return(false);
            }

            IAttributeSource lAttributeSource = rTarget.GetComponent <IAttributeSource>();

            if (lAttributeSource == null)
            {
                return(false);
            }

            if (!lAttributeSource.AttributeExists(AttributeName))
            {
                return(false);
            }

            float lValue = lAttributeSource.GetAttributeValue <float>(AttributeName);

            lValue = lValue + UnityEngine.Random.Range(MinRandom, MaxRandom);

            switch (ComparisonIndex)
            {
            case 0:
                return(lValue == Value);

            case 1:
                return(lValue != Value);

            case 2:
                return(lValue < Value);

            case 3:
                return(lValue <= Value);

            case 4:
                return(lValue > Value);

            case 5:
                return(lValue >= Value);
            }

            return(false);
        }