Exemplo n.º 1
0
        public void breaklink(int myinputIndx)
        {
            StrategyBaseBlock otherblock = this.inputLnks[myinputIndx];
            int dex = otherblock.outputLnks.FindIndex(item => item == this);

            otherblock.outputLnks[dex]  = null;
            this.inputLnks[myinputIndx] = null;
        }
Exemplo n.º 2
0
 /// <summary>
 /// Resets all in
 /// </summary>
 public void zeroize()
 {
     if (inputLnks != null)
     {
         for (int i = 0; i < inputLnks.Length; i++)
         {
             StrategyBaseBlock lnk = inputLnks[i];
             if (lnk != null)
             {
                 lnk.zeroize();
                 lnk       = null;
                 output    = null;
                 inputs[i] = null;
             }
         }
     }
 }
Exemplo n.º 3
0
        public StragegyObject_Default()
            : base()
        {
            StrategyWayPoint    wpnt          = new StrategyWayPoint();
            StrategyClosest     closest1      = new StrategyClosest();//(null, null);
            StrategyThisObj     thisobj       = new StrategyThisObj();
            StrategyThisEnemys  thisobjEnemys = new StrategyThisEnemys();
            StrategyLocdata     enloc         = new StrategyLocdata();
            StrategyVeldata     envel         = new StrategyVeldata();
            Strategyinput_Types type          = new Strategyinput_Types();

            wpnt.inputLnks[0] = enloc;
            wpnt.inputLnks[1] = envel;

            closest1.inputLnks[0] = thisobj;
            closest1.inputLnks[1] = thisobjEnemys;
            closest1.inputLnks[2] = type;
            closest1.outputLnks.Add(enloc);
            closest1.outputLnks.Add(envel);

            enloc.inputLnks[0] = closest1;
            enloc.outputLnks.Add(wpnt);

            envel.inputLnks[0] = closest1;
            envel.outputLnks.Add(wpnt);

            waypointObj = wpnt;
            blocks      = new StrategyBaseBlock[3] {
                closest1, enloc, envel
            };

            targetObjs = new StrategyBaseBlock[1] {
                closest1
            };

            weaponslists = new List <Dictionary <int, MountedComponentTemplate> >();
            Dictionary <int, MountedComponentTemplate> wpnsinFC0 = new Dictionary <int, MountedComponentTemplate>();

            for (int i = 0; i < 10; i++)
            {
                wpnsinFC0.Add(i, null);
            }

            weaponslists.Add(wpnsinFC0);
        }
Exemplo n.º 4
0
 public virtual void calc(CombatObject comObj)
 {
     for (int i = 0; i < inputLnks.Length; i++)
     {
         StrategyBaseBlock lnk = inputLnks[i];
         if (lnk == null)
         {
             inputs[i] = DefaultValues[i];
         }
         else
         {
             if (lnk.output == null)
             {
                 lnk.calc(comObj);
             }
             inputs[i] = lnk.output;
         }
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// links thisblock to another blocks output.
        /// </summary>
        /// <param name="myinputIndx">the input link</param>
        /// <param name="otherblock">the other block</param>
        public void makelink(int myinputIndx, StrategyBaseBlock otherblock)
        {
            if (inputtypes == null)
            {
                throw new InvalidOperationException("Input types for strategy block not initialized.");
            }
            if (inputtypes.Length <= myinputIndx)
            {
                throw new ArgumentOutOfRangeException("This strategy block does not have that many inputs.");
            }
            if (!inputtypes[myinputIndx].Type.IsAssignableFrom(otherblock.outputType.Type))
            {
                throw new ArgumentException("Cannot link an output of type " + otherblock.outputType + " to an input of type " + inputtypes[myinputIndx] + ".");
            }

            this.inputLnks[myinputIndx] = otherblock;
            if (!otherblock.outputLnks.Contains(this))
            {
                otherblock.outputLnks.Add(this);
            }
        }
Exemplo n.º 6
0
 public StrategyObject(string name, StrategyBaseBlock waypointstratObj, StrategyBaseBlock[] targetstratObjs)
 {
     this.waypointObj = waypointstratObj;
     this.targetObjs  = targetstratObjs;
     this.Name        = name;
 }