本文整理汇总了C#中Rot4类的典型用法代码示例。如果您正苦于以下问题:C# Rot4类的具体用法?C# Rot4怎么用?C# Rot4使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Rot4类属于命名空间,在下文中一共展示了Rot4类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawGhost
public override void DrawGhost( ThingDef def, IntVec3 center, Rot4 rot )
{
var vecNorth = center + IntVec3.North.RotatedBy( rot );
var vecSouth = center + IntVec3.South.RotatedBy( rot );
if ( !vecNorth.InBounds() || !vecSouth.InBounds() )
{
return;
}
GenDraw.DrawFieldEdges( new List< IntVec3 >
{
vecNorth
}, new Color( 1f, 0.7f, 0f, 0.5f ) );
GenDraw.DrawFieldEdges( new List< IntVec3 >
{
vecSouth
}, Color.white );
var controlledRoom = vecNorth.GetRoom();
var otherRoom = vecSouth.GetRoom();
if ( controlledRoom == null || otherRoom == null )
{
return;
}
if ( !controlledRoom.UsesOutdoorTemperature )
{
GenDraw.DrawFieldEdges( controlledRoom.Cells.ToList(), new Color( 1f, 0.7f, 0f, 0.5f ) );
}
}
示例2: AllowsPlacing
public override AcceptanceReport AllowsPlacing(BuildableDef checkingDef, IntVec3 loc, Rot4 rot)
{
bool flag = false;
List<Thing> list = Find.ThingGrid.ThingsListAt(loc);
if (list.Count > 0)
{
foreach (Thing current in list)
{
if (current.def.category == ThingCategory.Building)
{
if (current.def.holdsRoof && current.def.coversFloor && current.def.altitudeLayer == AltitudeLayer.BuildingTall && current.def.passability == Traversability.Impassable)
{
flag = true;
break;
}
}
}
}
else
{
flag = false;
}
AcceptanceReport result;
if (flag)
{
result = true;
}
else
{
result = "Need to be placed on a colony wall";
}
return result;
}
示例3: GenerateSmallRoomWeaponRoom
public static void GenerateSmallRoomWeaponRoom(IntVec3 areaSouthWestOrigin, int zoneAbs, int zoneOrd, Rot4 rotation, ref OG_OutpostData outpostData)
{
IntVec3 origin = Zone.GetZoneOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd);
IntVec3 rotatedOrigin = Zone.GetZoneRotatedOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd, rotation);
OG_Common.GenerateEmptyRoomAt(rotatedOrigin + new IntVec3(smallRoomWallOffset, 0, smallRoomWallOffset).RotatedBy(rotation), Genstep_GenerateOutpost.zoneSideSize - 2 * smallRoomWallOffset, Genstep_GenerateOutpost.zoneSideSize - 2 * smallRoomWallOffset, rotation, TerrainDefOf.Concrete, TerrainDef.Named("MetalTile"), ref outpostData);
// Spawn weapon racks, weapons and lamps.
Building_Storage rack = OG_Common.TrySpawnThingAt(ThingDefOf.EquipmentRack, ThingDefOf.Steel, rotatedOrigin + new IntVec3(smallRoomWallOffset + 1, 0, smallRoomWallOffset + 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData)as Building_Storage;
TrySpawnWeaponOnRack(rack);
rack.GetStoreSettings().filter.SetAllow(ThingCategoryDef.Named("WeaponsMelee"), false);
rack.GetStoreSettings().Priority = StoragePriority.Critical;
rack = OG_Common.TrySpawnThingAt(ThingDefOf.EquipmentRack, ThingDefOf.Steel, rotatedOrigin + new IntVec3(smallRoomWallOffset + 4, 0, smallRoomWallOffset + 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData) as Building_Storage;
TrySpawnWeaponOnRack(rack);
rack.GetStoreSettings().filter.SetAllow(ThingCategoryDef.Named("WeaponsMelee"), false);
rack.GetStoreSettings().Priority = StoragePriority.Critical;
rack = OG_Common.TrySpawnThingAt(ThingDefOf.EquipmentRack, ThingDefOf.Steel, rotatedOrigin + new IntVec3(smallRoomWallOffset + 2, 0, smallRoomWallOffset + 5).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData) as Building_Storage;
TrySpawnWeaponOnRack(rack);
rack.GetStoreSettings().filter.SetAllow(ThingCategoryDef.Named("WeaponsMelee"), false);
rack.GetStoreSettings().Priority = StoragePriority.Critical;
rack = OG_Common.TrySpawnThingAt(ThingDefOf.EquipmentRack, ThingDefOf.Steel, rotatedOrigin + new IntVec3(smallRoomWallOffset + 5, 0, smallRoomWallOffset + 5).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData) as Building_Storage;
TrySpawnWeaponOnRack(rack);
rack.GetStoreSettings().filter.SetAllow(ThingCategoryDef.Named("WeaponsMelee"), false);
rack.GetStoreSettings().Priority = StoragePriority.Critical;
OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(smallRoomWallOffset + 1, 0, smallRoomWallOffset + 3).RotatedBy(rotation), Color.white, ref outpostData);
OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(smallRoomWallOffset + 5, 0, smallRoomWallOffset + 3).RotatedBy(rotation), Color.white, ref outpostData);
// Spawn vertical alley and door.
for (int zOffset = smallRoomWallOffset; zOffset <= Genstep_GenerateOutpost.zoneSideSize - smallRoomWallOffset; zOffset++)
{
Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(Genstep_GenerateOutpost.zoneSideCenterOffset, 0, zOffset).RotatedBy(rotation), TerrainDef.Named("PavedTile"));
}
OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(Genstep_GenerateOutpost.zoneSideCenterOffset, 0, Genstep_GenerateOutpost.zoneSideSize - smallRoomWallOffset - 1).RotatedBy(rotation), ref outpostData);
}
示例4: GetRandomFreeCardinalZoneAdjacentTo
public static bool GetRandomFreeCardinalZoneAdjacentTo(int zoneAbs, int zoneOrd, out Rot4 cardinal, ZoneProperties[,] zoneMap, int horizontalZonesNumber, int verticalZonesNumber)
{
// Get the free zones.
List<Rot4> cardinalList = new List<Rot4>();
for (int cardinalAsInt = 0; cardinalAsInt < 4; cardinalAsInt++)
{
int testedZoneAbs = 0;
int testedZoneOrd = 0;
Rot4 testedCardinal = new Rot4(cardinalAsInt);
Zone.GetAdjacentZone(zoneAbs, zoneOrd, testedCardinal, out testedZoneAbs, out testedZoneOrd);
if (ZoneIsInArea(testedZoneAbs, testedZoneOrd, horizontalZonesNumber, verticalZonesNumber))
{
if (zoneMap[testedZoneOrd, testedZoneAbs].zoneType == ZoneType.NotYetGenerated)
{
cardinalList.Add(testedCardinal);
}
}
}
if (cardinalList.Count == 0)
{
cardinal = Rot4.North;
return false;
}
else
{
cardinal = cardinalList.RandomElement<Rot4>();
return true;
}
}
示例5: AllowsPlacing
public override AcceptanceReport AllowsPlacing( BuildableDef checkingDef, IntVec3 loc, Rot4 rot )
{
ThingDef def = checkingDef as ThingDef;
var Restrictions = def.GetCompProperties( typeof( RestrictedPlacement_Comp ) ) as RestrictedPlacement_Properties;
if( Restrictions == null ){
Log.Error( "Could not get restrictions!" );
return (AcceptanceReport)false;
}
// Override steam-geyser restriction
if( ( Restrictions.RestrictedThing.FindIndex( r => r == ThingDefOf.SteamGeyser ) >= 0 )&&
( ThingDefOf.GeothermalGenerator != ( checkingDef as ThingDef ) ) ){
var newGeo = checkingDef as ThingDef;
ThingDefOf.GeothermalGenerator = newGeo;
}
foreach( Thing t in loc.GetThingList() ){
if( ( Restrictions.RestrictedThing.Find( r => r == t.def ) != null )&&
( t.Position == loc ) )
return (AcceptanceReport)true;
}
return "MessagePlacementNotHere".Translate();
}
示例6: DrawGhost
public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot)
{
GenDraw.DrawFieldEdges(
FindUtil.SquareAreaAround(center, Mathf.RoundToInt(def.specialDisplayRadius))
.Where(cell => cell.Walkable() && cell.InBounds())
.ToList());
}
示例7: GenerateMediumRoomPrison
public static void GenerateMediumRoomPrison(IntVec3 areaSouthWestOrigin, int zoneAbs, int zoneOrd, Rot4 rotation, ref OG_OutpostData outpostData)
{
IntVec3 origin = Zone.GetZoneOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd);
IntVec3 rotatedOrigin = Zone.GetZoneRotatedOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd, rotation);
OG_Common.GenerateEmptyRoomAt(rotatedOrigin + new IntVec3(0, 0, 1).RotatedBy(rotation), 5, 9, rotation, TerrainDefOf.Concrete, null, ref outpostData);
OG_Common.GenerateEmptyRoomAt(rotatedOrigin + new IntVec3(4, 0, 1).RotatedBy(rotation), 3, 9, rotation, TerrainDefOf.Concrete, null, ref outpostData);
OG_Common.GenerateEmptyRoomAt(rotatedOrigin + new IntVec3(6, 0, 1).RotatedBy(rotation), 5, 9, rotation, TerrainDefOf.Concrete, null, ref outpostData);
// Spawn prisoner beds.
OG_Common.TrySpawnThingAt(ThingDef.Named("Bed"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(1, 0, 8).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData);
OG_Common.TrySpawnThingAt(ThingDef.Named("Stool"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(2, 0, 8).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData);
OG_Common.TrySpawnThingAt(ThingDef.Named("Bed"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(3, 0, 8).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData);
OG_Common.TrySpawnThingAt(ThingDef.Named("Bed"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(7, 0, 2).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData);
OG_Common.TrySpawnThingAt(ThingDef.Named("Stool"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(8, 0, 2).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData);
OG_Common.TrySpawnThingAt(ThingDef.Named("Bed"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(9, 0, 2).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData);
// Spawn lamps, heaters and coolers.
OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(3, 0, 2).RotatedBy(rotation), Color.white, ref outpostData);
OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(7, 0, 8).RotatedBy(rotation), Color.white, ref outpostData);
OG_Common.TrySpawnHeaterAt(rotatedOrigin + new IntVec3(1, 0, 2).RotatedBy(rotation), ref outpostData);
OG_Common.TrySpawnHeaterAt(rotatedOrigin + new IntVec3(9, 0, 8).RotatedBy(rotation), ref outpostData);
OG_Common.SpawnCoolerAt(rotatedOrigin + new IntVec3(0, 0, 2).RotatedBy(rotation), new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData);
OG_Common.SpawnCoolerAt(rotatedOrigin + new IntVec3(10, 0, 8).RotatedBy(rotation), new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData);
// Spawn vertical alley and door.
for (int zOffset = 0; zOffset <= 10; zOffset++)
{
Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(5, 0, zOffset).RotatedBy(rotation), TerrainDef.Named("PavedTile"));
}
OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(4, 0, 3).RotatedBy(rotation), ref outpostData);
OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(6, 0, 7).RotatedBy(rotation), ref outpostData);
OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(5, 0, 1).RotatedBy(rotation), ref outpostData);
OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(5, 0, 9).RotatedBy(rotation), ref outpostData);
}
示例8: GetAdjacentZone
public static void GetAdjacentZone(int zoneAbs, int zoneOrd, Rot4 direction, out int adjacentZoneAbs, out int adjacentZoneOrd)
{
adjacentZoneAbs = 0;
adjacentZoneOrd = 0;
if (direction == Rot4.North)
{
adjacentZoneAbs = zoneAbs;
adjacentZoneOrd = zoneOrd + 1;
}
else if (direction == Rot4.East)
{
adjacentZoneAbs = zoneAbs + 1;
adjacentZoneOrd = zoneOrd;
}
else if (direction == Rot4.South)
{
adjacentZoneAbs = zoneAbs;
adjacentZoneOrd = zoneOrd - 1;
}
else if (direction == Rot4.West)
{
adjacentZoneAbs = zoneAbs - 1;
adjacentZoneOrd = zoneOrd;
}
}
示例9: AllowsPlacing
public override AcceptanceReport AllowsPlacing(BuildableDef checkingDef, IntVec3 loc, Rot4 rot)
{
string reason = "";
bool canBePlacedHere = Building_LaserFencePylon.CanPlaceNewPylonHere(loc, out reason);
if (canBePlacedHere == false)
{
return new AcceptanceReport(reason);
}
// Display potential placing positions.
foreach (Thing pylon in Find.ListerThings.ThingsOfDef(ThingDef.Named("LaserFencePylon").blueprintDef))
{
if (pylon.Position.InHorDistOf(loc, 6f))
{
Building_LaserFencePylon.DrawPotentialPlacePositions(pylon.Position);
}
}
foreach (Thing pylon in Find.ListerThings.ThingsOfDef(ThingDef.Named("LaserFencePylon").frameDef))
{
if (pylon.Position.InHorDistOf(loc, 6f))
{
Building_LaserFencePylon.DrawPotentialPlacePositions(pylon.Position);
}
}
foreach (Thing pylon in Find.ListerThings.ThingsOfDef(ThingDef.Named("LaserFencePylon")))
{
if (pylon.Position.InHorDistOf(loc, 6f))
{
Building_LaserFencePylon.DrawPotentialPlacePositions(pylon.Position);
}
}
return true;
}
示例10: AllowsPlacing
/// <summary>
/// Checks if a new force field generator can be built at this location.
/// - must not be too near from another force field generator (or it would perturb other fields).
/// </summary>
public override AcceptanceReport AllowsPlacing(BuildableDef checkingDef, IntVec3 loc, Rot4 rot)
{
// Check if another force field generator is not too close.
List<Thing> forceFieldGeneratorList = new List<Thing>();
IEnumerable<Thing> list = Find.ListerThings.ThingsOfDef(ThingDef.Named("ForceFieldGenerator"));
foreach (Thing generator in list)
{
forceFieldGeneratorList.Add(generator);
}
list = Find.ListerThings.ThingsOfDef(ThingDef.Named("ForceFieldGenerator").blueprintDef);
foreach (Thing generator in list)
{
forceFieldGeneratorList.Add(generator);
}
list = Find.ListerThings.ThingsOfDef(ThingDef.Named("ForceFieldGenerator").frameDef);
foreach (Thing generator in list)
{
forceFieldGeneratorList.Add(generator);
}
foreach (Thing generator in forceFieldGeneratorList)
{
if (generator.Position.InHorDistOf(loc, minDistanceBetweenTwoForceFieldGenerators))
{
return new AcceptanceReport("An other force field generator is too close (would generate perturbations).");
}
}
// Display effect zone.
List<IntVec3> coveredCells = Building_ForceFieldGenerator.GetCoveredCells(loc, rot);
GenDraw.DrawFieldEdges(coveredCells);
return true;
}
示例11: AllowsPlacing
public override AcceptanceReport AllowsPlacing(BuildableDef checkingDef, IntVec3 loc, Rot4 rot, Thing thingToIgnore = null)
{
IEnumerable<IntVec3> cells = GenAdj.CellsAdjacent8Way(loc, rot, checkingDef.Size).Union<IntVec3>(GenAdj.CellsOccupiedBy(loc, rot, checkingDef.Size));
foreach (IntVec3 cell in cells)
{
List<Thing> things = Map.thingGrid.ThingsListAt(cell);
foreach (Thing thing in things)
{
if (thing.TryGetComp<CompRTQuantumStockpile>() != null
|| thing.TryGetComp<CompRTQuantumChunkSilo>() != null)
{
return "PlaceWorker_RTNoQSOverlap".Translate();
}
else if (thing.def.entityDefToBuild != null)
{
ThingDef thingDef = thing.def.entityDefToBuild as ThingDef;
if (null != thingDef &&
null != thingDef.comps &&
null != thingDef.comps.Find(x => typeof(CompRTQuantumStockpile) == x.compClass))
{
return "PlaceWorker_RTNoQSOverlap".Translate();
}
}
}
}
return true;
}
示例12: AllowsPlacing
/// <summary>
/// Display the scan range of built mobile mineral sonar and the max scan range at the tested position.
/// Allow placement nearly anywhere.
/// </summary>
public override AcceptanceReport AllowsPlacing(BuildableDef checkingDef, IntVec3 loc, Rot4 rot)
{
IEnumerable<Building> mobileMineralSonarList = Find.ListerBuildings.AllBuildingsColonistOfDef(ThingDef.Named("MobileMineralSonar"));
if (mobileMineralSonarList != null)
{
foreach (Building mobileMineralSonar in mobileMineralSonarList)
{
(mobileMineralSonar as Building_MobileMineralSonar).DrawMaxScanRange();
}
}
ResearchProjectDef mmsResearch = ResearchProjectDef.Named("ResearchMobileMineralSonarEnhancedScan");
if (Find.ResearchManager.GetProgress(mmsResearch) >= mmsResearch.CostApparent)
{
Material scanRange30 = MaterialPool.MatFrom("Effects/ScanRange30");
Vector3 scanRangeScale30 = new Vector3(60f, 1f, 60f);
Matrix4x4 scanRangeMatrix30 = default(Matrix4x4);
// The 10f offset on Y axis is mandatory to be over the fog of war.
scanRangeMatrix30.SetTRS(loc.ToVector3Shifted() + new Vector3(0f, 10f, 0f) + Altitudes.AltIncVect, (0f).ToQuat(), scanRangeScale30);
Graphics.DrawMesh(MeshPool.plane10, scanRangeMatrix30, scanRange30, 0);
}
else
{
Material scanRange50 = MaterialPool.MatFrom("Effects/ScanRange50");
Vector3 scanRangeScale50 = new Vector3(100f, 1f, 100f);
Matrix4x4 scanRangeMatrix50 = default(Matrix4x4);
// The 10f offset on Y axis is mandatory to be over the fog of war.
scanRangeMatrix50.SetTRS(loc.ToVector3Shifted() + new Vector3(0f, 10f, 0f) + Altitudes.AltIncVect, (0f).ToQuat(), scanRangeScale50);
Graphics.DrawMesh(MeshPool.plane10, scanRangeMatrix50, scanRange50, 0);
}
return true;
}
示例13: DrawGhost
/// <summary>
/// Draws a target highlight on all connectable Hoppers around target
/// </summary>
/// <param name="def"></param>
/// <param name="center"></param>
/// <param name="rot"></param>
public override void DrawGhost( ThingDef def, IntVec3 center, Rot4 rot )
{
List<CompHopper> hoppers = CompHopperUser.FindHoppers( center, rot, def.Size );
foreach( var hopper in hoppers )
{
GenDraw.DrawTargetHighlight( hopper.parent );
}
}
示例14: AllowsPlacing
public override AcceptanceReport AllowsPlacing( BuildableDef checkingDef, IntVec3 loc, Rot4 rot )
{
if( CompHopper.FindHopperUser( loc + rot.FacingCell ) != null )
{
return ( AcceptanceReport )true;
}
return ( AcceptanceReport )( "Must connect to a building that needs a hopper." );
}
示例15: DrawGhost
/// <summary>
/// Draws a target highlight on Hopper user
/// </summary>
/// <param name="def"></param>
/// <param name="center"></param>
/// <param name="rot"></param>
public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot)
{
Thing hopperUser = CompHopper.FindHopperUser( center + rot.FacingCell );
if ( (hopperUser != null) && !hopperUser.OccupiedRect().Cells.Contains( center ) )
{
GenDraw.DrawTargetHighlight( hopperUser );
}
}