Exemplo n.º 1
0
        //检查控制仓是否存在,并看看战甲是否存在
        public void checkControlerExist(Building_ControlCell build)
        {
            if (!ControlCellAndBeControler.ContainsKey(build))
            {
                return;
            }

            var becontroler = ControlCellAndBeControler.TryGetValue(build);

            if (!build.Spawned || build.Destroyed)
            {
                remove2pawnRelation(build, becontroler);
            }

            if (becontroler == null || !becontroler.Spawned && !wfSpawned(becontroler) || becontroler.Dead)
            {
                // Log.Warning(becontroler+"/"+becontroler.Spawned+"/"+becontroler.Dead+"/"+ becontroler.IsWorldPawn());
                remove2pawnRelation(build, becontroler);
            }
        }
Exemplo n.º 2
0
        /*
         * public void saveOldGun(Pawn wf,ThingWithComps gun) {
         *  clearWFandOG(wf);
         *  WarframeAndOldgun.Add(wf,gun);
         * }
         * public ThingWithComps getOldGun(Pawn wf) {
         *  return WarframeAndOldgun.TryGetValue(wf);
         * }
         * public void clearWFandOG(Pawn wf) {
         *  if (WarframeAndOldgun.ContainsKey(wf))
         *  {
         *      WarframeAndOldgun.Remove(wf);
         *  }
         * }
         */

        //清除建筑和战甲关系
        public void remove2pawnRelation(Building_ControlCell build, Pawn becontroler)
        {
            try
            {
                /*
                 * bool check1 = false;
                 * bool check2 = false;
                 * if (ControlCellAndBeControler.ContainsKey(build) && ControlCellAndBeControler.TryGetValue(build) == becontroler)
                 * {
                 *  check1 = true;
                 * }
                 * if (BeControlerAndControlCell.ContainsKey(becontroler) && BeControlerAndControlCell.TryGetValue(becontroler) == build)
                 * {
                 *  check2 = true;
                 * }
                 * if (check1 && check2)
                 * {
                 */
                //if (build != null && build.Spawned)
                ControlCellAndBeControler.Remove(build);
                build.becontroler = null;
                //if (becontroler != null && becontroler.Spawned)
                BeControlerAndControlCell.Remove(becontroler);
                //SoundDef.Named("ra2_yuri_nocontrol").PlayOneShot(becontroler);
                if (becontroler.Dead)
                {
                    return;
                }

                becontroler.drafter.Drafted = false;

                //}
            }
            catch (Exception)
            {
                // ignored
            }
        }
Exemplo n.º 3
0
 //添加建筑战甲关系
 public void add2pawnRelation(Building_ControlCell build, Pawn becontroler)
 {
     ControlCellAndBeControler.Add(build, becontroler);
     BeControlerAndControlCell.Add(becontroler, build);
 }