本文整理汇总了C#中Vector3.ToIntVec3方法的典型用法代码示例。如果您正苦于以下问题:C# Vector3.ToIntVec3方法的具体用法?C# Vector3.ToIntVec3怎么用?C# Vector3.ToIntVec3使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vector3
的用法示例。
在下文中一共展示了Vector3.ToIntVec3方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ThrowSmokeRed
public static void ThrowSmokeRed(Vector3 loc, float size)
{
if (!loc.ShouldSpawnMotesAt() || MoteCounter.SaturatedLowPriority)
{
return;
}
MoteThrown moteThrown = (MoteThrown)ThingMaker.MakeThing(ThingDef.Named("Mote_SmokeRed"), null);
moteThrown.ScaleUniform = Rand.Range(1.5f, 2.5f) * size;
moteThrown.exactRotationRate = Rand.Range(-0.5f, 0.5f);
moteThrown.exactPosition = loc;
moteThrown.SetVelocityAngleSpeed((float)Rand.Range(30, 40), Rand.Range(0.008f, 0.012f));
GenSpawn.Spawn(moteThrown, loc.ToIntVec3());
}
示例2: ThrowLightningGlowGreen
public static void ThrowLightningGlowGreen(Vector3 loc, float size)
{
if (!loc.ShouldSpawnMotesAt())
{
return;
}
MoteThrown moteThrown = (MoteThrown)ThingMaker.MakeThing(DefDatabase<ThingDef>.GetNamed("Mote_LightningGlowGreen", true), null);
moteThrown.ScaleUniform = 6f * size;
moteThrown.exactRotationRate = 0f;
moteThrown.exactPosition = loc;
moteThrown.exactPosition += new Vector3(0.5f, 0f, 0.5f);
//moteThrown.SetVelocityAngleSpeed((float)Rand.Range(0, 0), Rand.Range(0.0002f, 0.0002f));
GenSpawn.Spawn(moteThrown, loc.ToIntVec3());
}
示例3: ThrowMicroSparksRed
public static void ThrowMicroSparksRed(Vector3 loc)
{
if (!loc.ShouldSpawnMotesAt() || MoteCounter.Saturated)
{
return;
}
MoteThrown moteThrown = (MoteThrown)ThingMaker.MakeThing(ThingDef.Named("Mote_MicroSparksRed"), null);
moteThrown.ScaleUniform = Rand.Range(0.8f, 1.2f);
moteThrown.exactRotationRate = Rand.Range(-0.2f, 0.2f);
moteThrown.exactPosition = loc;
moteThrown.exactPosition -= new Vector3(0.5f, 0f, 0.5f);
moteThrown.exactPosition += new Vector3(Rand.Value, 0f, Rand.Value);
moteThrown.SetVelocityAngleSpeed((float)Rand.Range(35, 45), Rand.Range(0.02f, 0.02f));
GenSpawn.Spawn(moteThrown, loc.ToIntVec3());
}
示例4: GetPartialCoverBetween
/// <summary>
/// Checks for cover along the flight path of the bullet, doesn't check for walls or plants, only intended for cover with partial fillPercent
/// </summary>
private bool GetPartialCoverBetween(Vector3 sourceLoc, Vector3 targetLoc, out Thing cover)
{
//Sanity check
if (this.verbProps.projectileDef.projectile.flyOverhead)
{
cover = null;
return false;
}
sourceLoc.Scale(new Vector3(1, 0, 1));
targetLoc.Scale(new Vector3(1, 0, 1));
//Calculate segment vector and segment amount
Vector3 shotVec = sourceLoc - targetLoc; //Vector from target to source
Vector3 segmentVec = shotVec.normalized * segmentLength;
float distToCheck = Mathf.Min(distToCheckForCover, shotVec.magnitude); //The distance to raycast
float numSegments = distToCheck / segmentLength;
//Raycast accross all segments to check for cover
List<IntVec3> checkedCells = new List<IntVec3>();
Thing targetThing = GridsUtility.GetEdifice(targetLoc.ToIntVec3());
Thing newCover = null;
for (int i = 0; i <= numSegments; i++)
{
IntVec3 cell = (targetLoc + segmentVec * i).ToIntVec3();
if (!checkedCells.Contains(cell))
{
//Cover check, if cell has cover compare fillPercent and get the highest piece of cover, ignore if cover is the target (e.g. solar panels, crashed ship, etc)
Thing coverAtCell = GridsUtility.GetCover(cell);
if (coverAtCell != null
&& (targetThing == null || !coverAtCell.Equals(targetThing))
&& (newCover == null || newCover.def.fillPercent < coverAtCell.def.fillPercent))
{
newCover = coverAtCell;
}
}
}
cover = newCover;
//Report success if found cover that is not a wall or plant
return (cover != null
&& cover.def.Fillage != FillCategory.Full
&& cover.def.category != ThingCategory.Plant); //Don't care about trees
}
示例5: ActivateMatrixAbsorbtionEffect
public void ActivateMatrixAbsorbtionEffect(Vector3 absorbtionPosition)
{
if ((absorbtionPosition.ToIntVec3() == this.coveredCells[0])
|| (absorbtionPosition.ToIntVec3() == this.coveredCells[1]))
{
this.matrixIsStartingAbsorbion[0] = true;
}
else if ((absorbtionPosition.ToIntVec3() == this.coveredCells[2])
|| (absorbtionPosition.ToIntVec3() == this.coveredCells[3]))
{
this.matrixIsStartingAbsorbion[1] = true;
}
else if ((absorbtionPosition.ToIntVec3() == this.coveredCells[4])
|| (absorbtionPosition.ToIntVec3() == this.coveredCells[5]))
{
this.matrixIsStartingAbsorbion[2] = true;
}
else if ((absorbtionPosition.ToIntVec3() == this.coveredCells[6])
|| (absorbtionPosition.ToIntVec3() == this.coveredCells[7]))
{
this.matrixIsStartingAbsorbion[3] = true;
}
else if ((absorbtionPosition.ToIntVec3() == this.coveredCells[8])
|| (absorbtionPosition.ToIntVec3() == this.coveredCells[9]))
{
this.matrixIsStartingAbsorbion[4] = true;
}
}
示例6: CheckForFreeInterceptBetween
//Removed minimum collision distance
private bool CheckForFreeInterceptBetween(Vector3 lastExactPos, Vector3 newExactPos)
{
IntVec3 lastPos = lastExactPos.ToIntVec3();
IntVec3 newPos = newExactPos.ToIntVec3();
if (newPos == lastPos)
{
return false;
}
if (!lastPos.InBounds() || !newPos.InBounds())
{
return false;
}
if ((newPos - lastPos).LengthManhattan == 1)
{
return this.CheckForFreeIntercept(newPos);
}
//Check for minimum collision distance
float distToTarget = this.assignedTarget != null ? (this.assignedTarget.DrawPos - this.origin).MagnitudeHorizontal() : (this.destination - this.origin).MagnitudeHorizontal();
if (this.def.projectile.alwaysFreeIntercept
|| distToTarget <= 1f ? this.origin.ToIntVec3().DistanceToSquared(newPos) > 1f : this.origin.ToIntVec3().DistanceToSquared(newPos) > Mathf.Min(12f, distToTarget / 2))
{
Vector3 currentExactPos = lastExactPos;
Vector3 flightVec = newExactPos - lastExactPos;
Vector3 sectionVec = flightVec.normalized * 0.2f;
int numSections = (int)(flightVec.MagnitudeHorizontal() / 0.2f);
ProjectileCR.checkedCells.Clear();
int currentSection = 0;
while (true)
{
currentExactPos += sectionVec;
IntVec3 intVec3 = currentExactPos.ToIntVec3();
if (!ProjectileCR.checkedCells.Contains(intVec3))
{
if (this.CheckForFreeIntercept(intVec3))
{
break;
}
ProjectileCR.checkedCells.Add(intVec3);
}
currentSection++;
if (currentSection > numSections)
{
return false;
}
if (intVec3 == newPos)
{
return false;
}
}
return true;
}
return false;
}
示例7: DropStuff
private void DropStuff(Thing thing)
{
Vector3 VecOffset = new Vector3(0, 0,2);
IntVec3 IntSquare= ClutterBeds.Position + VecOffset.ToIntVec3().RotatedBy(ClutterBeds.Rotation);
ClutterBeds.GetContainer().TryDrop(thing, IntSquare, ThingPlaceMode.Direct, out thing);
CompAffectedByFacilities Fcomp = ClutterBeds.GetComp<CompAffectedByFacilities>();
Fcomp.Notify_LinkRemoved(thing);
}