TechbloxModdingAPI/GamecraftModdingAPI/Blocks/SpawnPoint.cs
2020-11-09 16:18:25 -05:00

79 lines
2 KiB
C#

using System;
using RobocraftX.Blocks;
using RobocraftX.Common;
using Gamecraft.CharacterVulnerability;
using Svelto.ECS;
using Unity.Mathematics;
using GamecraftModdingAPI;
using GamecraftModdingAPI.Utility;
namespace GamecraftModdingAPI.Blocks
{
public class SpawnPoint : Block
{
public SpawnPoint(EGID id) : base(id)
{
}
public SpawnPoint(uint id) : base(new EGID(id, CommonExclusiveGroups.SPAWNPOINT_BLOCK_GROUP))
{
}
// custom spawn point properties
/// <summary>
/// The lives the player spawns in with.
/// </summary>
public uint Lives
{
get => BlockEngine.GetBlockInfo(this, (SpawnPointStatsEntityStruct st) => st.lives);
set
{
BlockEngine.SetBlockInfo(this, (ref SpawnPointStatsEntityStruct st, uint val) => st.lives = val, value);
}
}
/// <summary>
/// Whether the spawned player can take damage.
/// </summary>
public bool Damageable
{
get => BlockEngine.GetBlockInfo(this, (SpawnPointStatsEntityStruct st) => st.canTakeDamage);
set
{
BlockEngine.SetBlockInfo(this, (ref SpawnPointStatsEntityStruct st, bool val) => st.canTakeDamage = val, value);
}
}
/// <summary>
/// Whether the game over screen will be displayed
/// </summary>
public bool GameOverEnabled
{
get => BlockEngine.GetBlockInfo(this, (SpawnPointStatsEntityStruct st) => st.gameOverScreen);
set
{
BlockEngine.SetBlockInfo(this, (ref SpawnPointStatsEntityStruct st, bool val) => st.gameOverScreen = val, value);
}
}
/// <summary>
/// The team id for players who spawn here.
/// </summary>
public byte Team
{
get => BlockEngine.GetBlockInfo(this, (SpawnPointIdsEntityStruct st) => st.teamId);
set
{
BlockEngine.SetBlockInfo(this, (ref SpawnPointIdsEntityStruct st, byte val) => st.teamId = val, value);
}
}
}
}