コード例 #1
0
        public static int GetBuildingCost(Building b, TraverseParms traverseParms, Pawn pawn)
        {
            Building_Door building_Door = b as Building_Door;

            if (building_Door != null)
            {
                switch (traverseParms.mode)
                {
                case TraverseMode.ByPawn:
                    if (!traverseParms.canBash && building_Door.IsForbiddenToPass(pawn))
                    {
                        if (DebugViewSettings.drawPaths)
                        {
                            CVPathFinder.DebugFlash(b.Position, b.Map, 0.77f, "forbid");
                        }
                        return(2147483647);
                    }
                    if (!building_Door.FreePassage)
                    {
                        if (building_Door.PawnCanOpen(pawn))
                        {
                            return(building_Door.TicksToOpenNow);
                        }
                        if (traverseParms.canBash)
                        {
                            return(300);
                        }
                        if (DebugViewSettings.drawPaths)
                        {
                            CVPathFinder.DebugFlash(b.Position, b.Map, 0.34f, "cant pass");
                        }
                        return(2147483647);
                    }
                    break;

                case TraverseMode.NoPassClosedDoors:
                case TraverseMode.NoPassClosedDoorsOrWater:
                    if (!building_Door.FreePassage)
                    {
                        return(2147483647);
                    }
                    break;
                }
            }
            else if (pawn != null)
            {
                return((int)b.PathFindCostFor(pawn));
            }
            return(0);
        }
コード例 #2
0
 private void DebugFlash(IntVec3 c, float colorPct, string str)
 {
     CVPathFinder.DebugFlash(c, this.map, colorPct, str);
 }