Lots more work on implementing battling
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System.Collections;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using PkmnLib.Static.Utils;
|
||||
|
||||
namespace PkmnLib.Dynamic.ScriptHandling;
|
||||
|
||||
@@ -29,7 +30,7 @@ public class ScriptContainer : IEnumerable<ScriptContainer>
|
||||
/// <summary>
|
||||
/// The script in this container.
|
||||
/// </summary>
|
||||
public Script? Script { get; set; } = null;
|
||||
public Script? Script { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerator<ScriptContainer> GetEnumerator()
|
||||
@@ -42,4 +43,27 @@ public class ScriptContainer : IEnumerable<ScriptContainer>
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
|
||||
public void Set(Script script)
|
||||
{
|
||||
if (Script is not null)
|
||||
{
|
||||
Script.OnRemove();
|
||||
Script.MarkForDeletion();
|
||||
}
|
||||
Script = script;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the script from this container.
|
||||
/// </summary>
|
||||
public void Clear()
|
||||
{
|
||||
if (Script is not null)
|
||||
{
|
||||
Script.OnRemove();
|
||||
Script.MarkForDeletion();
|
||||
}
|
||||
Script = null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user