Esempio n. 1
0
        public void AddAction(AuroraAction action)
        {
            // TODO: Implement commandable check for all the types that have it
            //if (GetType() == typeof(Creature))
            //{
            //    AuroraUTC utc = (AuroraUTC)template;
            //    if (utc.Commandable == 0)
            //    {
            //        // Cannot add the action
            //        return;
            //    }
            //}

            actions.Add(action);
        }
Esempio n. 2
0
        void RunOneAction()
        {
            if (actions.Count == 0)
            {
                return;
            }

            AuroraAction action = actions[0];

            //Debug.Log("Found action of type " + action.GetType().Name + " on " + gameObject.name);

            // Check if the action should not run
            if (action.IsFinishedBefore())
            {
                actions.RemoveAt(0);
                return;
            }

            // Run the action for this frame
            try
            {
                action.RunAction();
            }
            catch (NotImplementedException e)
            {
                // This is ok
                Debug.Log("Skipping not-implemented action: " + e);
                actions.RemoveAt(0);
                return;
            }

            // Check if the action should now be deleted
            if (action.IsFinishedAfter())
            {
                actions.RemoveAt(0);
                return;
            }
        }