コード例 #1
0
        // EXECUTABLE: ----------------------------------------------------------------------------

        public override bool Check(GameObject target)
        {
            GameObject targetGO = this.target.GetGameObject(target);

            if (targetGO == null)
            {
                Debug.LogError("Condition Status Effect: No target defined");
                return(false);
            }

            Stats stats = targetGO.GetComponentInChildren <Stats>();

            if (stats == null)
            {
                Debug.LogError("Condition Status Effect: Could not get Stats component in target");
                return(false);
            }

            if (stats.HasStatusEffect(this.statusEffect))
            {
                return(true);
            }

            return(false);
        }
コード例 #2
0
        // EXECUTABLE: ----------------------------------------------------------------------------

        public override bool Check(GameObject target)
        {
            GameObject targetGO = this.target.GetGameObject(target);

            if (!targetGO)
            {
                Debug.LogError("Condition Status Effect: No target defined");
                return(false);
            }

            Stats stats = targetGO.GetComponentInChildren <Stats>();

            if (!stats)
            {
                Debug.LogError("Condition Status Effect: Could not get Stats component in target");
                return(false);
            }

            bool hasStatusEffect = stats.HasStatusEffect(this.statusEffect, this.minAmount);

            if (this.condition == Operation.HasStatusEffect && hasStatusEffect)
            {
                return(true);
            }
            if (this.condition == Operation.DoesNotHave && !hasStatusEffect)
            {
                return(true);
            }

            return(false);
        }