本文整理汇总了C#中System.Angle.ClockwiseFrom方法的典型用法代码示例。如果您正苦于以下问题:C# Angle.ClockwiseFrom方法的具体用法?C# Angle.ClockwiseFrom怎么用?C# Angle.ClockwiseFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Angle
的用法示例。
在下文中一共展示了Angle.ClockwiseFrom方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AI
public override void AI()
{
NPC npc = Main.npc[octopus];
if (!npc.active || npc.type != mod.NPCType("Octopus"))
{
return;
}
projectile.timeLeft = 2;
Player player = Main.player[npc.target];
projectile.position = npc.Center;
Vector2 offset = player.Center - projectile.position;
float distance = offset.Length() + 32f;
Angle currAngle = new Angle(projectile.rotation);
Angle angleToPlayer = new Angle((float)Math.Atan2(offset.Y, offset.X));
Angle min = new Angle(minAngle);
Angle max = new Angle(maxAngle);
Angle limit = new Angle((minAngle + maxAngle) / 2f);
if (limit.Between(min, max))
{
limit = limit.Opposite();
}
Angle buffer = new Angle(angleBuffer);
if (angleToPlayer.Between(min - buffer, max + buffer))
{
if (currAngle.Between(max, limit))
{
angleSpeed -= maxAngleSpeed / 10f;
}
else if (currAngle.Between(limit, min))
{
angleSpeed += maxAngleSpeed / 10f;
}
else if (currAngle.ClockwiseFrom(angleToPlayer))
{
angleSpeed += maxAngleSpeed / 10f;
}
else
{
angleSpeed -= maxAngleSpeed / 10f;
}
if (length > maxLength)
{
lengthSpeed -= maxLengthSpeed / 10f;
}
else if (length < minLength)
{
lengthSpeed += maxLengthSpeed / 10f;
}
else if (distance > length)
{
lengthSpeed += maxLengthSpeed / 10f;
}
else if (distance < length)
{
lengthSpeed -= maxLengthSpeed / 10f;
}
}
else
{
if (currAngle.Between(max, limit))
{
angleSpeed -= maxAngleSpeed / 10f;
}
else if (currAngle.Between(limit, min))
{
angleSpeed += maxAngleSpeed / 10f;
}
else if (angleSpeed > 0f)
{
angleSpeed += maxAngleSpeed / 20f;
}
else if (angleSpeed < 0f)
{
angleSpeed -= maxAngleSpeed / 20f;
}
else
{
angleSpeed = maxAngleSpeed / 20f;
}
if (length > minLength)
{
lengthSpeed -= maxLengthSpeed / 10f;
}
else
{
lengthSpeed += maxLengthSpeed / 10f;
}
}
if (angleSpeed > maxAngleSpeed)
{
angleSpeed = maxAngleSpeed;
}
else if (angleSpeed < -maxAngleSpeed)
{
angleSpeed = -maxAngleSpeed;
}
if (lengthSpeed > maxLengthSpeed)
{
lengthSpeed = maxLengthSpeed;
}
//.........这里部分代码省略.........