NorbiPeti
5bbb54c0c5
And store delegates of dynamic methods invoking constructors Tested with the automated tests
102 lines
2.7 KiB
C#
102 lines
2.7 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)
|
|
{
|
|
if (!BlockEngine.GetBlockInfoExists<SpawnPointStatsEntityStruct>(this.Id))
|
|
{
|
|
throw new BlockTypeException($"Block is not a {this.GetType().Name} block");
|
|
}
|
|
}
|
|
|
|
public SpawnPoint(uint id) : base(new EGID(id, CommonExclusiveGroups.BUILD_SPAWNPOINT_BLOCK_GROUP))
|
|
{
|
|
if (!BlockEngine.GetBlockInfoExists<SpawnPointStatsEntityStruct>(this.Id))
|
|
{
|
|
throw new BlockTypeException($"Block is not a {this.GetType().Name} block");
|
|
}
|
|
}
|
|
|
|
// custom spawn point properties
|
|
|
|
/// <summary>
|
|
/// The lives the player spawns in with.
|
|
/// </summary>
|
|
public uint Lives
|
|
{
|
|
get
|
|
{
|
|
return BlockEngine.GetBlockInfo<SpawnPointStatsEntityStruct>(Id).lives;
|
|
}
|
|
|
|
set
|
|
{
|
|
ref SpawnPointStatsEntityStruct spses = ref BlockEngine.GetBlockInfo<SpawnPointStatsEntityStruct>(Id);
|
|
spses.lives = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Whether the spawned player can take damage.
|
|
/// </summary>
|
|
public bool Damageable
|
|
{
|
|
get
|
|
{
|
|
return BlockEngine.GetBlockInfo<SpawnPointStatsEntityStruct>(Id).canTakeDamage;
|
|
}
|
|
|
|
set
|
|
{
|
|
ref SpawnPointStatsEntityStruct spses = ref BlockEngine.GetBlockInfo<SpawnPointStatsEntityStruct>(Id);
|
|
spses.canTakeDamage = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Whether the game over screen will be displayed
|
|
/// </summary>
|
|
public bool GameOverEnabled
|
|
{
|
|
get
|
|
{
|
|
return BlockEngine.GetBlockInfo<SpawnPointStatsEntityStruct>(Id).gameOverScreen;
|
|
}
|
|
|
|
set
|
|
{
|
|
ref SpawnPointStatsEntityStruct spses = ref BlockEngine.GetBlockInfo<SpawnPointStatsEntityStruct>(Id);
|
|
spses.gameOverScreen = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// The team id for players who spawn here.
|
|
/// </summary>
|
|
public byte Team
|
|
{
|
|
get
|
|
{
|
|
return BlockEngine.GetBlockInfo<SpawnPointIdsEntityStruct>(Id).teamId;
|
|
}
|
|
|
|
set
|
|
{
|
|
ref SpawnPointIdsEntityStruct spses = ref BlockEngine.GetBlockInfo<SpawnPointIdsEntityStruct>(Id);
|
|
spses.teamId = value;
|
|
}
|
|
}
|
|
}
|
|
}
|