2021-07-17 02:37:09 +02:00
|
|
|
|
using System;
|
2020-09-26 15:25:22 +02:00
|
|
|
|
using Robust.Shared.Maths;
|
|
|
|
|
|
using Robust.Shared.Serialization;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Content.Shared.Arcade
|
|
|
|
|
|
{
|
|
|
|
|
|
[Serializable, NetSerializable]
|
|
|
|
|
|
public struct BlockGameBlock
|
|
|
|
|
|
{
|
|
|
|
|
|
public Vector2i Position;
|
|
|
|
|
|
public readonly BlockGameBlockColor GameBlockColor;
|
|
|
|
|
|
|
|
|
|
|
|
public BlockGameBlock(Vector2i position, BlockGameBlockColor gameBlockColor)
|
|
|
|
|
|
{
|
|
|
|
|
|
Position = position;
|
|
|
|
|
|
GameBlockColor = gameBlockColor;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Serializable, NetSerializable]
|
|
|
|
|
|
public enum BlockGameBlockColor
|
|
|
|
|
|
{
|
|
|
|
|
|
Red,
|
|
|
|
|
|
Orange,
|
|
|
|
|
|
Yellow,
|
|
|
|
|
|
Green,
|
|
|
|
|
|
Blue,
|
|
|
|
|
|
LightBlue,
|
|
|
|
|
|
Purple
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static class BlockGameVector2Extensions{
|
|
|
|
|
|
public static BlockGameBlock ToBlockGameBlock(this Vector2i vector2, BlockGameBlock.BlockGameBlockColor gameBlockColor)
|
|
|
|
|
|
{
|
2020-11-27 11:00:49 +01:00
|
|
|
|
return new(vector2, gameBlockColor);
|
2020-09-26 15:25:22 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static Vector2i AddToX(this Vector2i vector2, int amount)
|
|
|
|
|
|
{
|
2020-11-27 11:00:49 +01:00
|
|
|
|
return new(vector2.X + amount, vector2.Y);
|
2020-09-26 15:25:22 +02:00
|
|
|
|
}
|
|
|
|
|
|
public static Vector2i AddToY(this Vector2i vector2, int amount)
|
|
|
|
|
|
{
|
2020-11-27 11:00:49 +01:00
|
|
|
|
return new(vector2.X, vector2.Y + amount);
|
2020-09-26 15:25:22 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static Vector2i Rotate90DegreesAsOffset(this Vector2i vector)
|
|
|
|
|
|
{
|
2020-11-27 11:00:49 +01:00
|
|
|
|
return new(-vector.Y, vector.X);
|
2020-09-26 15:25:22 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|