Esempio n. 1
0
        public bool RemCB(PriorityCB cb, PCBType cbt)
        {
            //Debug.Log("Cell " + this.loc.ToString() + " removing CB type " + cbt.ToString());
            List <PriorityCB> lst = null;

            if (cbt == PCBType.shoot)
            {
                lst = this.shootCBs;
            }                                                            // Avante Garde Formatting
            else if (cbt == PCBType.build)
            {
                lst = this.buildCBs;
            }
            else if (cbt == PCBType.scout)
            {
                lst = this.scoutCBs;
            }
            else
            {
                Debug.LogError("Cell rem nbCB: Unhandled state! " + cbt.ToString());
                return(false);
            }
            PriorityCB rem = lst.SingleOrDefault(i => i.p == cb.p && i.f == cb.f);

            if (rem != null)
            {
                lst.Remove(rem);
            }
            else
            {
                Debug.LogError("Found none or more than 1 matching item to remove, rem is null: len" + lst.Count.ToString());
                return(false);
            }
            return(true);
        }
Esempio n. 2
0
 //Cells will call these to add CBs to other cells
 public void RemCellCallback(int p, Vector2Int loc, PriorityCB cb, PCBType cbt)
 {
     if (!this.CheckLocInRange(loc))
     {
         return;
     }
     //Debug.Log("PB: RemCellCallback: loc: " + loc.ToString() + ", type: " + cbt.ToString());
     this.GetCell(p, loc).RemCB(cb, cbt);
 }
Esempio n. 3
0
        public bool AddCB(PriorityCB cb, PCBType cbt)
        {
            //Debug.Log("Cell " + this.loc.ToString() + " adding CB!");
            switch (cbt)
            {
            case PCBType.shoot:
                this.shootCBs.Add(cb);
                break;

            case PCBType.build:
                this.buildCBs.Add(cb);
                break;

            case PCBType.scout:
                this.scoutCBs.Add(cb);
                break;

            default:
                Debug.LogError("Cell AddCB: Unhandled state! " + cbt.ToString());
                return(false);
            }
            return(true);
        }