Ejemplo n.º 1
0
        private void Start()
        {
            // Go through all the Reactions and call their Init function.
            for (int i = 0; i < Reactions.Length; i++)
            {
                // The DelayedReaction 'hides' the Reaction's Init function with it's own.
                // This means that we have to try to cast the Reaction to a DelayedReaction and then if it exists call it's Init function.
                // Note that this mainly done to demonstrate hiding and not especially for functionality.
                DelayedReaction delayedReaction = Reactions[i] as DelayedReaction;

                if (delayedReaction)
                {
                    delayedReaction.Init();
                }
                else
                {
                    Reactions[i].Init();
                }
            }
        }
Ejemplo n.º 2
0
        public void React()
        {
            // Reaction debug options actions
            DebugModeActions();

            // Go through all the Reactions and call their React function.
            for (int i = 0; i < Reactions.Length; i++)
            {
                // The DelayedReaction hides the Reaction.React function.
                // Note again this is mainly done for demonstration purposes.
                DelayedReaction delayedReaction = Reactions[i] as DelayedReaction;

                if (delayedReaction)
                {
                    delayedReaction.React(this);
                }
                else
                {
                    Reactions[i].React(this);
                }
            }
        }