コード例 #1
0
        private ActionsToDo analyzePhenomenon(Phenomenon targetPhenomenon)
        {
            //Consts.writeEnteringMethodToDebugLog(System.Reflection.MethodBase.GetCurrentMethod().ReflectedType + "." + System.Reflection.MethodBase.GetCurrentMethod().Name);
            ActionsToDo result = null;

            if (targetPhenomenon._subobject == subobject.Existence && targetPhenomenon._behaviour == behaviour.Empty)
            {
                result = new ActionsToDo(action.Build, targetPhenomenon._objectID, priority.Normal, targetPhenomenon._parameters);
            }            //object does not exists, assuming need to build
            else if (targetPhenomenon._subobject == subobject.Capacity && targetPhenomenon._behaviour == behaviour.Full)
            {
                result = new ActionsToDo(action.Build, targetPhenomenon._objectID, priority.Normal, parameters.None);
            }            //capacity is full, assuming need to build
            else if (targetPhenomenon._subobject == subobject.Capacity && targetPhenomenon._behaviour == behaviour.Empty)
            {
                if (targetPhenomenon._objectID == Consts.stronghold_treasury)
                {
                    Program._aStronghold.Treasury.depositGold(100); //solution in the meantime
                }                                                   //treasury is running out of money
                else if (targetPhenomenon._objectID == Consts.stronghold_jobs)
                {
                    //create a farm job
                    result = new ActionsToDo(action.Build, Consts.farm, priority.Normal, parameters.None);
                }        //no jobs available in stronghold
            }            //capacity is empty
            //Consts.writeExitingMethodToDebugLog(System.Reflection.MethodBase.GetCurrentMethod().ReflectedType + "." + System.Reflection.MethodBase.GetCurrentMethod().Name);
            return(result);
        }
コード例 #2
0
        public void insertPhenomenon(int targetOwnerID, int targetObjectTypeID, subobject targetSubObject, behaviour targetBehaviour, parameters targetParameters)
        {
            //Consts.writeEnteringMethodToDebugLog(System.Reflection.MethodBase.GetCurrentMethod().ReflectedType + "." + System.Reflection.MethodBase.GetCurrentMethod().Name);
            Phenomenon targetPhenomenon = new Phenomenon(targetOwnerID, targetObjectTypeID, targetSubObject, targetBehaviour, targetParameters);

            listOfPhenomenons.AddLast(targetPhenomenon);

            ActionsToDo toDo = analyzePhenomenon(targetPhenomenon);

            if (toDo != null)
            {
                listOfActionsToDo.insertItemIntoQueue(toDo);
            }            //only if there is something to do.
                         //Consts.writeExitingMethodToDebugLog(System.Reflection.MethodBase.GetCurrentMethod().ReflectedType + "." + System.Reflection.MethodBase.GetCurrentMethod().Name);
        }