/// <summary>
        /// Perform the action
        /// </summary>
        /// <returns></returns>
        protected override void Execute(bool isStart)
        {
            // use cached version unless target could be dynamic (TargetType.CollidingGameObject)
            var targetFinal = _cachedFinalTarget;

            if (targetFinal == null)
            {
                targetFinal = GameActionHelper.ResolveTarget <Button>(TargetType, this, Target);
                if (TargetType != GameActionHelper.TargetType.CollidingGameObject)
                {
                    _cachedFinalTarget = targetFinal;
                }
            }

            Assert.IsNotNull(targetFinal,
                             "Ensure that you specify a Target button when using the 'Set Button Interactable' action.");

            targetFinal.interactable = Interactable;
            if (AnimateChanges)
            {
                Debug.LogWarning("Animation of Button Interactable State changes is only supported if using the Beautiful Transitions asset. See the Menu | Window | Game Framework | Integrations Window for more information.");
#if BEAUTIFUL_TRANSITIONS
                BeautifulTransitions.Scripts.DisplayItem.DisplayItemHelper.SetActiveAnimated(Owner, targetFinal.gameObject, Interactable);
#else
#endif
            }
        }
Beispiel #2
0
        /// <summary>
        /// Perform the action
        /// </summary>
        /// <returns></returns>
        protected override void Execute(bool isStart)
        {
            var targetFinal = GameActionHelper.ResolveTarget(TargetType, this, Target);

            if (targetFinal != null)
            {
                Destroy(targetFinal);
            }
        }
        /// <summary>
        /// Setup
        /// </summary>
        protected void Start()
        {
            GameActionHelper.InitialiseGameActions(_actionReferences, this);

            if (AutomaticallyRun == AutomaticallyRunEnum.OnStart)
            {
                ExecuteActions();
            }
        }
Beispiel #4
0
        /// <summary>
        /// Setup
        /// </summary>
        protected void Start()
        {
            GameConditionHelper.InitialiseGameConditions(_conditionReferences);
            GameActionHelper.InitialiseGameActions(_actionReferencesConditionMet);
            GameActionHelper.InitialiseGameActions(_actionReferencesConditionNotMet);

            GameConditionHelper.AddListeners(_conditionReferences, EvaluateConditionChanges);

            RunMethod(true);
        }
        /// <summary>
        /// Determine teh target that should be used based upon the chosen TargetType
        /// </summary>
        /// <returns></returns>
        public UnityEngine.GameObject ResolveTarget()
        {
            var targetFinal = GameActionHelper.ResolveTarget(TargetType, this, Target);

            if (targetFinal == null)
            {
                Debug.LogWarningFormat("No Target is specified for the action {0} on {1}", GetType().Name, Owner.gameObject.name);
            }
            return(targetFinal);
        }
Beispiel #6
0
        void Start()
        {
            if (OnlyWhenLevelRunning)
            {
                Assert.IsTrue(LevelManager.IsActive, string.Format("The CollisionHandler on {0} has Only When Level Running set, but no LevelManager was found. Either add one or clear this setting", name));
            }

            GameActionHelper.InitialiseGameActions(Enter.ActionReferences, this);
            GameActionHelper.InitialiseGameActions(Within.ActionReferences, this);
            GameActionHelper.InitialiseGameActions(Exit.ActionReferences, this);
        }
Beispiel #7
0
        /// <summary>
        /// Perform the action
        /// </summary>
        /// <returns></returns>
        protected override void Execute(bool isStart)
        {
            var targetFinal = GameActionHelper.ResolveTarget(TargetType, this, Target);

            if (targetFinal == null)
            {
                Debug.LogWarningFormat("No Target is specified for the action {0} on {1}", GetType().Name, Owner.gameObject.name);
            }
            if (targetFinal != null)
            {
                Destroy(targetFinal);
            }
        }
        /// <summary>
        /// Perform the action
        /// </summary>
        /// <returns></returns>
        protected override void Execute(bool isStart)
        {
            // use cached version unless target could be dynamic (TargetType.CollidingGameObject)
            var transformFinal = GameActionHelper.ResolveTarget <Transform>(LocationTargetType, this, Location);

            if (transformFinal == null)
            {
                Debug.LogWarningFormat("No Target Location is specified for the action {0} on {1}", GetType().Name, Owner.gameObject.name);
            }
            if (Prefab != null && transformFinal != null)
            {
                Instantiate(Prefab, transformFinal.position, transformFinal.rotation);
            }
        }
Beispiel #9
0
        /// <summary>
        /// Called by the base class from start and optionally if a condition might have changed.
        /// </summary>
        /// <param name="isStart"></param>
        public void RunMethod(bool isStart = true)
        {
            var newIsConditionMet = GameConditionHelper.AllConditionsMet(_conditionReferences, this);

            if (isStart || newIsConditionMet != _isConditionMet)
            {
                _isConditionMet = newIsConditionMet;

                if (_isConditionMet)
                {
                    GameActionHelper.PerformActions(_actionReferencesConditionMet, this);
                }
                else
                {
                    GameActionHelper.PerformActions(_actionReferencesConditionNotMet, this);
                }
            }
        }
Beispiel #10
0
        /// <summary>
        /// Perform the action
        /// </summary>
        /// <returns></returns>
        protected override void Execute(bool isStart)
        {
#if PRO_POOLING
            if (!string.IsNullOrEmpty(PoolName))
            {
                // use cached version unless target could be dynamic (TargetType.CollidingGameObject)
                var transformFinal = GameActionHelper.ResolveTargetComponent <Transform>(LocationTargetType, this, Location);
                if (transformFinal == null)
                {
                    Debug.LogWarningFormat("No Target Location is specified for the action {0} on {1}", GetType().Name, Owner.gameObject.name);
                }
                if (transformFinal != null)
                {
                    global::ProPooling.Components.GlobalPools.Instance.Spawn(PoolName,
                                                                             transformFinal.position,
                                                                             transformFinal.rotation);
                }
            }
#endif
        }
        /// <summary>
        /// Perform the action
        /// </summary>
        /// <returns></returns>
        protected override void Execute(bool isStart)
        {
            var switchFromFinal = GameActionHelper.ResolveTarget(SwitchFromTargetType, this, SwitchFrom);

            if (switchFromFinal == null)
            {
                Debug.LogWarningFormat("No Target is specified for the action {0} on {1}", GetType().Name, Owner.gameObject.name);
            }
            if (switchFromFinal != null)
            {
                if (isStart)
                {
                    GameObjectToGameObjectAnimation.SwapImmediately(switchFromFinal, SwitchTo);
                }
                else
                {
                    GameObjectToGameObjectAnimation.AnimatedSwap(Owner, switchFromFinal, SwitchTo);
                }
            }
        }
Beispiel #12
0
        /// <summary>
        /// Perform the action
        /// </summary>
        /// <returns></returns>
        protected override void Execute(bool isStart)
        {
            var targetFinal = GameActionHelper.ResolveTarget(TargetType, this, Target);

            if (targetFinal == null)
            {
                Debug.LogWarningFormat("No Target is specified for the action {0} on {1}", GetType().Name, Owner.gameObject.name);
            }
            if (targetFinal != null)
            {
                var rigidBody2D = targetFinal.GetComponent <Rigidbody2D>();
                if (rigidBody2D != null)
                {
                    rigidBody2D.bodyType = BodyType;
                }
                else
                {
                    Debug.LogWarningFormat("No rigidbody found for the action {0} on {1}", GetType().Name, targetFinal.gameObject.name);
                }
            }
        }
        /// <summary>
        /// Perform the action
        /// </summary>
        /// <returns></returns>
        protected override void Execute(bool isStart)
        {
            // use cached version unless target could be dynamic (TargetType.CollidingGameObject)
            var targetFinal = _cachedFinalTarget;

            if (targetFinal == null)
            {
                targetFinal = GameActionHelper.ResolveTargetComponent <TransitionBase>(TargetType, this, Target);
                if (TargetType != GameActionHelper.TargetType.CollidingGameObject)
                {
                    _cachedFinalTarget = targetFinal;
                }
            }

            if (targetFinal == null)
            {
                Debug.LogWarningFormat("No Target is specified for the action {0} on {1}", GetType().Name, Owner.gameObject.name);
            }
            if (targetFinal != null)
            {
                targetFinal.TransitionOut();
            }
        }
Beispiel #14
0
 /// <summary>
 /// Processing of any trigger data.
 /// </summary>
 /// <param name="triggerData"></param>
 void ProcessTriggerData(TriggerData triggerData, GameObject collidingGameObject)
 {
     GameActionHelper.PerformActions(triggerData.ActionReferences, this);
     triggerData.Callback.Invoke(collidingGameObject);
 }
Beispiel #15
0
 /// <summary>
 /// Processing of any trigger data.
 /// </summary>
 /// <param name="triggerData"></param>
 /// <param name="collidingGameObject"></param>
 void ProcessTriggerData(TriggerData triggerData, GameAction.GameActionInvocationContext context)
 {
     GameActionHelper.ExecuteGameActions(triggerData.ActionReferences, false, context);
     triggerData.Callback.Invoke(context.OtherGameObject);
 }
 /// <summary>
 /// Run all of the attached Game Actions.
 /// </summary>
 /// <param name="isStart"></param>
 public void ExecuteActions()
 {
     GameActionHelper.ExecuteGameActions(_actionReferences, false);
 }
Beispiel #17
0
 void Start()
 {
     GameActionHelper.InitialiseGameActions(Enter.ActionReferences);
     GameActionHelper.InitialiseGameActions(Within.ActionReferences);
     GameActionHelper.InitialiseGameActions(Exit.ActionReferences);
 }