A game of chance inspired by Plates of Fate: Mayhem and Plates of Fate: Remastered
Here's an example of an empty event class that does nothing
public class ExampleEvent : PlatesEventAttribute
{
public ExampleEvent(){
name = "example_event";
text = " plate(s) will do nothing in ";
type = EventType.Plate;
}
}
name
- The name of the event for use with the plates_event
console command
text
- The text shown when the event is counting down
type
- Can be EventType.Plate
, EventType.Player
or EventType.Arena
depending on how you want your event to act (More details below)
When type = EventType.Plate
, the affected Plate is highlighted and the OnEvent(Plate plate)
function is called.
public class PlateGrow10Event : PlatesEventAttribute
{
public PlateGrow10Event(){
name = "plate_grow_10";
text = " plate(s) will grow 10% in ";
type = EventType.Plate;
}
public override void OnEvent(Plate plate){
plate.Grow(0.10f);
}
}
When type = EventType.Player
, the affected Player is highlighted and the OnEvent(Entity entity)
function is called.
public class PlayerGrowEvent : PlatesEventAttribute
{
public PlayerGrowEvent(){
name = "player_grow";
text = " player(s) will grow in ";
type = EventType.Player;
}
public override void OnEvent(Entity entity){
entity.Scale += 0.1f;
}
}
When type = EventType.Arena
, nothing is highlighted and the OnEvent()
function is called.
Because nothing is highlighted, you'll have to apply glow to the entities you affect yourself (if any)
public class ArenaPlateGrow10Event : PlatesEventAttribute
{
public ArenaPlateGrow10Event(){
name = "arena_grow_10";
text = "All plates will grow 10% in ";
type = EventType.Arena;
minAffected = 1;
maxAffected = 1;
}
public override void OnEvent(){
foreach(var plate in Entity.All.OfType<Plate>()){
plate.Grow(0.10f);
plate.GlowActive = true;
plate.GlowColor = Color.Blue;
}
}
}
minAffected
- The minimum amount of times the event should trigger
maxAffected
- The maximum amount of times the event should trigger
(Arena events typically have both set to 1
but you can set them to whatever you want in any other event type)
Here's an example of a round type that does nothing
public class BigPlatesRoundType : PlatesRoundAttribute
{
public BigPlatesRoundType(){
name = "Nothing";
command = "round_nothing";
}
public override void OnEvent(){
Log.Info("Nothing happened");
}
}
name
- The name of the round shown in-game
command
- The name of the round for use in the plates_round
console command
OnEvent()
- This function is called at the start of the game after all plates have been initialized
These are useful debug tools for testing newly added events and round types.
plates_start
- Force starts a new game. Don't use this while a game is already running.
plates_event <event_name>
- Sets the next event in the current game.
plates_round <round_name>
- Sets the round type of the next game.
If you're creating a custom Entity that you want to be properly cleaned up on Game End, add this to your entity's constructor:
PlatesGame.AddEntity(this);
or when instantiating your entity, you can add it to a plate's entity list so it's cleaned up when the plate is destroyed:
public override void OnEvent(Plate plate){
var ent = new PlateGrowInfinitelyEnt(plate);
plate.AddEntity(ent);
}
If you're making custom UI for one of your events, create a class that looks something like this:
[LoadUI]
public class ExampleUI : Panel
{
}
The class must derive Panel
and must have [LoadUI]
the line above to be added to the RootPanel on game start.