Exemple #1
0
        public List<ICommand> getTypeCommands()
        {
            List<ICommand> cmdlist = new List<ICommand>();

            ICommand cmd;

            if (this.intMovement > 0)
            {
                cmd = new comMove(this);
                cmdlist.Add(cmd);
            }

            if (this.intResourceValue > 0)
            {
                cmd = new comDropResource(this, null);
                cmdlist.Add(cmd);

                if (this.blnCanSpawnUnits)
                {
                    cmd = new comPlaceUnit(this);
                    cmdlist.Add(cmd);
                }
            }

            if (this.intCreateValuePerRound > 0)
            {
                cmd = new comCreateResource(this);
                cmdlist.Add(cmd);
            }

            return cmdlist;
        }
        private void createDropResourceCommandsForSektor(Sektor aktSek, int intDistance)
        {
            foreach (clsSektorKoordinaten aktVektor in m_DirectionVektors)
            {
                Sektor newSek = this.FieldField.move(aktSek, aktVektor);

                if (newSek != null && aktSek.strUniqueID != newSek.strUniqueID)
                {
                    if (newSek.ListUnits.Count > 0)
                    {
                        foreach (clsUnit objPosibleRecieverUnit in newSek.ListUnits)
                        {
                            if (objPosibleRecieverUnit.Id != m_objDeliverUnit.Id
                                    && objPosibleRecieverUnit.blnCanStoreResourceValue
                                    && objPosibleRecieverUnit.strOwnerID == m_objDeliverUnit.strOwnerID
                                    && !m_listPossibleDrops.Contains(objPosibleRecieverUnit)
                                )
                            {
                                m_listPossibleDrops.Add(objPosibleRecieverUnit);

                                comDropResource readyCmd = new comDropResource(m_objDeliverUnit, objPosibleRecieverUnit);

                                Sektor targetSek = this.FieldField.get(newSek.objSektorKoord);

                                readyCmd.TargetSektor = targetSek;

                                this.raiseOnNewCommand(readyCmd);
                            }
                        }
                    }

                    intDistance += 1;

                    //atm zu Dev zwecken: es kann ins eigene Feld und in anliegende Deliverd werden
                    if (intDistance < 1)
                    {
                        createDropResourceCommandsForSektor(newSek, intDistance);
                    }
                }

            }
        }