Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Gore_UpdateSail()

void Terraria.Gore.Gore_UpdateSail ( )
inlineprivate

Definition at line 1213 of file Gore.cs.

1214 {
1215 if (velocity.Y < 0f)
1216 {
1217 Vector2 vector = new Vector2(velocity.X, 0.6f);
1218 int num = 32;
1219 if (TextureAssets.Gore[type].IsLoaded)
1220 {
1221 num = TextureAssets.Gore[type].Width();
1222 if (TextureAssets.Gore[type].Height() < num)
1223 {
1224 num = TextureAssets.Gore[type].Height();
1225 }
1226 }
1227 num = (int)((float)num * 0.9f);
1228 vector = Collision.TileCollision(position, vector, (int)((float)num * scale), (int)((float)num * scale));
1229 vector.X *= 0.97f;
1230 if ((double)vector.X > -0.01 && (double)vector.X < 0.01)
1231 {
1232 vector.X = 0f;
1233 }
1234 if (timeLeft > 0)
1235 {
1236 timeLeft--;
1237 }
1238 else
1239 {
1240 alpha++;
1241 }
1242 velocity.X = vector.X;
1243 return;
1244 }
1245 velocity.Y += (float)Math.PI / 60f;
1246 Vector2 vector2 = new Vector2(Vector2.UnitY.RotatedBy(velocity.Y).X * 2f, Math.Abs(Vector2.UnitY.RotatedBy(velocity.Y).Y) * 3f);
1247 vector2 *= 2f;
1248 int num2 = 32;
1249 if (TextureAssets.Gore[type].IsLoaded)
1250 {
1251 num2 = TextureAssets.Gore[type].Width();
1252 if (TextureAssets.Gore[type].Height() < num2)
1253 {
1254 num2 = TextureAssets.Gore[type].Height();
1255 }
1256 }
1257 Vector2 vector3 = vector2;
1258 vector2 = Collision.TileCollision(position, vector2, (int)((float)num2 * scale), (int)((float)num2 * scale));
1259 if (vector2 != vector3)
1260 {
1261 velocity.Y = -1f;
1262 }
1263 position += vector2;
1264 rotation = vector2.ToRotation() + (float)Math.PI;
1265 if (timeLeft > 0)
1266 {
1267 timeLeft--;
1268 }
1269 else
1270 {
1271 alpha++;
1272 }
1273 }
static double Abs(double value)
const double PI
Definition Math.cs:16
static Asset< Texture2D >[] Gore
Vector2 velocity
Definition Gore.cs:19
Vector2 position
Definition Gore.cs:17
int type
Definition Gore.cs:27
int alpha
Definition Gore.cs:25
float rotation
Definition Gore.cs:21
float scale
Definition Gore.cs:23
int timeLeft
Definition Gore.cs:35

References System.Math.Abs(), Terraria.Gore.alpha, Terraria.GameContent.TextureAssets.Gore, System.Math.PI, Terraria.Gore.position, Terraria.Gore.rotation, Terraria.Gore.scale, Terraria.Collision.TileCollision(), Terraria.Gore.timeLeft, Terraria.Gore.type, Microsoft.Xna.Framework.Vector2.UnitY, Terraria.Gore.velocity, Microsoft.Xna.Framework.Vector2.X, and Microsoft.Xna.Framework.Vector2.Y.

Referenced by Terraria.Gore.Update().