Beispiel #1
0
        /// <summary>
        /// custom, private constructor, for custom deep copy purposes only
        /// </summary>
        /// <param name="macroActionToCopy"></param>
        private PD_MacroAction(
            PD_MacroAction macroActionToCopy
            )
        {
            this.Actions_All              = macroActionToCopy.Actions_All.CustomDeepCopy();
            this.Actions_Executable_Now   = macroActionToCopy.Actions_Executable_Now.CustomDeepCopy();
            this.Actions_Executable_Later = macroActionToCopy.Actions_Executable_Later.CustomDeepCopy();
            if (macroActionToCopy.NonExecutable_ShareKnowledge_Action != null)
            {
                this.NonExecutable_ShareKnowledge_Action = macroActionToCopy.NonExecutable_ShareKnowledge_Action.GetCustomDeepCopy();
            }

            this.MacroAction_Type     = macroActionToCopy.MacroAction_Type;
            this.MacroAction_WalkType = macroActionToCopy.MacroAction_WalkType;
        }
Beispiel #2
0
        public PD_MacroAction(
            List <PD_Action> actions_All,
            PD_MacroAction_Type macroAction_Type,
            PD_MacroAction_WalkType macroAction_WalkType,
            int current_NumAvailableActions
            )
        {
            // set the types, first
            MacroAction_Type     = macroAction_Type;
            MacroAction_WalkType = macroAction_WalkType;

            Actions_All              = new List <PD_Action>();
            Actions_Executable_Now   = new List <PD_Action>();
            Actions_Executable_Later = new List <PD_Action>();

            if (Is_TypeOf_TakePositionFor_ShareKnowledge_Any() == true)
            {
                Actions_All = actions_All.CustomDeepCopy();
                NonExecutable_ShareKnowledge_Action = Actions_All[Actions_All.Count - 1];
                Actions_All.Remove(NonExecutable_ShareKnowledge_Action);
            }
            else
            {
                Actions_All = actions_All.CustomDeepCopy();
            }

            if (Is_TypeOf_DuringMainPlayerActions())
            {
                for (int actionIndex = 0; actionIndex < Actions_All.Count; actionIndex++)
                {
                    if (actionIndex < current_NumAvailableActions)
                    {
                        Actions_Executable_Now.Add(Actions_All[actionIndex]);
                    }
                    else if (actionIndex >= current_NumAvailableActions)
                    {
                        Actions_Executable_Later.Add(Actions_All[actionIndex]);
                    }
                }
            }
            else if (Is_TypeOf_Discard_Any())
            {
                Actions_Executable_Now.AddRange(Actions_All);
            }
        }