Pular para o conteúdo principal

Class BattleController

Namespace: DiceRolling.Controllers
Assembly: dice-rolling.dll

Executa comandos de alto nível durante a batalha.

[Tool]
[Icon("res://assets/editor/controller.svg")]
[ScriptPath("res://controllers/battle/BattleController.cs")]
public class BattleController : Node, IDisposable

Inheritance

object ← GodotObject ← Node ← BattleController

Implements

IDisposable

Inherited Members

Show/Hide Inherited Members

Node.NotificationEnterTree,
Node.NotificationExitTree,
Node.NotificationMovedInParent,
Node.NotificationReady,
Node.NotificationPaused,
Node.NotificationUnpaused,
Node.NotificationPhysicsProcess,
Node.NotificationProcess,
Node.NotificationParented,
Node.NotificationUnparented,
Node.NotificationSceneInstantiated,
Node.NotificationDragBegin,
Node.NotificationDragEnd,
Node.NotificationPathRenamed,
Node.NotificationChildOrderChanged,
Node.NotificationInternalProcess,
Node.NotificationInternalPhysicsProcess,
Node.NotificationPostEnterTree,
Node.NotificationDisabled,
Node.NotificationEnabled,
Node.NotificationResetPhysicsInterpolation,
Node.NotificationEditorPreSave,
Node.NotificationEditorPostSave,
Node.NotificationWMMouseEnter,
Node.NotificationWMMouseExit,
Node.NotificationWMWindowFocusIn,
Node.NotificationWMWindowFocusOut,
Node.NotificationWMCloseRequest,
Node.NotificationWMGoBackRequest,
Node.NotificationWMSizeChanged,
Node.NotificationWMDpiChange,
Node.NotificationVpMouseEnter,
Node.NotificationVpMouseExit,
Node.NotificationOsMemoryWarning,
Node.NotificationTranslationChanged,
Node.NotificationWMAbout,
Node.NotificationCrash,
Node.NotificationOsImeUpdate,
Node.NotificationApplicationResumed,
Node.NotificationApplicationPaused,
Node.NotificationApplicationFocusIn,
Node.NotificationApplicationFocusOut,
Node.NotificationTextServerChanged,
Node.GetNode<T>(NodePath),
Node.GetNodeOrNull<T>(NodePath),
Node.GetChild<T>(int, bool),
Node.GetChildOrNull<T>(int, bool),
Node.GetOwner<T>(),
Node.GetOwnerOrNull<T>(),
Node.GetParent<T>(),
Node.GetParentOrNull<T>(),
Node._EnterTree(),
Node._ExitTree(),
Node._GetConfigurationWarnings(),
Node._Input(InputEvent),
Node._PhysicsProcess(double),
Node._Process(double),
Node._Ready(),
Node._ShortcutInput(InputEvent),
Node._UnhandledInput(InputEvent),
Node._UnhandledKeyInput(InputEvent),
Node.PrintOrphanNodes(),
Node.AddSibling(Node, bool),
Node.AddChild(Node, bool, Node.InternalMode),
Node.RemoveChild(Node),
Node.Reparent(Node, bool),
Node.GetChildCount(bool),
Node.GetChildren(bool),
Node.GetChild(int, bool),
Node.HasNode(NodePath),
Node.GetNode(NodePath),
Node.GetNodeOrNull(NodePath),
Node.GetParent(),
Node.FindChild(string, bool, bool),
Node.FindChildren(string, string, bool, bool),
Node.FindParent(string),
Node.HasNodeAndResource(NodePath),
Node.GetNodeAndResource(NodePath),
Node.IsInsideTree(),
Node.IsPartOfEditedScene(),
Node.IsAncestorOf(Node),
Node.IsGreaterThan(Node),
Node.GetPath(),
Node.GetPathTo(Node, bool),
Node.AddToGroup(StringName, bool),
Node.RemoveFromGroup(StringName),
Node.IsInGroup(StringName),
Node.MoveChild(Node, int),
Node.GetGroups(),
Node.GetIndex(bool),
Node.PrintTree(),
Node.PrintTreePretty(),
Node.GetTreeString(),
Node.GetTreeStringPretty(),
Node.PropagateNotification(int),
Node.PropagateCall(StringName, Array, bool),
Node.SetPhysicsProcess(bool),
Node.GetPhysicsProcessDeltaTime(),
Node.IsPhysicsProcessing(),
Node.GetProcessDeltaTime(),
Node.SetProcess(bool),
Node.IsProcessing(),
Node.SetProcessInput(bool),
Node.IsProcessingInput(),
Node.SetProcessShortcutInput(bool),
Node.IsProcessingShortcutInput(),
Node.SetProcessUnhandledInput(bool),
Node.IsProcessingUnhandledInput(),
Node.SetProcessUnhandledKeyInput(bool),
Node.IsProcessingUnhandledKeyInput(),
Node.CanProcess(),
Node.SetDisplayFolded(bool),
Node.IsDisplayedFolded(),
Node.SetProcessInternal(bool),
Node.IsProcessingInternal(),
Node.SetPhysicsProcessInternal(bool),
Node.IsPhysicsProcessingInternal(),
Node.IsPhysicsInterpolated(),
Node.IsPhysicsInterpolatedAndEnabled(),
Node.ResetPhysicsInterpolation(),
Node.SetTranslationDomainInherited(),
Node.GetWindow(),
Node.GetLastExclusiveWindow(),
Node.GetTree(),
Node.CreateTween(),
Node.Duplicate(int),
Node.ReplaceBy(Node, bool),
Node.SetSceneInstanceLoadPlaceholder(bool),
Node.GetSceneInstanceLoadPlaceholder(),
Node.SetEditableInstance(Node, bool),
Node.IsEditableInstance(Node),
Node.GetViewport(),
Node.QueueFree(),
Node.RequestReady(),
Node.IsNodeReady(),
Node.SetMultiplayerAuthority(int, bool),
Node.GetMultiplayerAuthority(),
Node.IsMultiplayerAuthority(),
Node.RpcConfig(StringName, Variant),
Node.GetRpcConfig(),
Node.Atr(string, StringName),
Node.AtrN(string, StringName, int, StringName),
Node.Rpc(StringName, params Variant[]),
Node.Rpc(StringName, ReadOnlySpan<Variant>),
Node.RpcId(long, StringName, params Variant[]),
Node.RpcId(long, StringName, ReadOnlySpan<Variant>),
Node.UpdateConfigurationWarnings(),
Node.CallDeferredThreadGroup(StringName, params Variant[]),
Node.CallDeferredThreadGroup(StringName, ReadOnlySpan<Variant>),
Node.SetDeferredThreadGroup(StringName, Variant),
Node.NotifyDeferredThreadGroup(int),
Node.CallThreadSafe(StringName, params Variant[]),
Node.CallThreadSafe(StringName, ReadOnlySpan<Variant>),
Node.SetThreadSafe(StringName, Variant),
Node.NotifyThreadSafe(int),
Node.EmitSignalReady(),
Node.EmitSignalRenamed(),
Node.EmitSignalTreeEntered(),
Node.EmitSignalTreeExiting(),
Node.EmitSignalTreeExited(),
Node.EmitSignalChildEnteredTree(Node),
Node.EmitSignalChildExitingTree(Node),
Node.EmitSignalChildOrderChanged(),
Node.EmitSignalReplacingBy(Node),
Node.EmitSignalEditorDescriptionChanged(Node),
Node.EmitSignalEditorStateChanged(),
Node.InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant),
Node.HasGodotClassMethod(in godot_string_name),
Node.HasGodotClassSignal(in godot_string_name),
Node.Name,
Node.UniqueNameInOwner,
Node.SceneFilePath,
Node.Owner,
Node.Multiplayer,
Node.ProcessMode,
Node.ProcessPriority,
Node.ProcessPhysicsPriority,
Node.ProcessThreadGroup,
Node.ProcessThreadGroupOrder,
Node.ProcessThreadMessages,
Node.PhysicsInterpolationMode,
Node.AutoTranslateMode,
Node.EditorDescription,
Node.Ready,
Node.Renamed,
Node.TreeEntered,
Node.TreeExiting,
Node.TreeExited,
Node.ChildEnteredTree,
Node.ChildExitingTree,
Node.ChildOrderChanged,
Node.ReplacingBy,
Node.EditorDescriptionChanged,
Node.EditorStateChanged,
GodotObject.NotificationPostinitialize,
GodotObject.NotificationPredelete,
GodotObject.NotificationExtensionReloaded,
GodotObject.InstanceFromId(ulong),
GodotObject.IsInstanceIdValid(ulong),
GodotObject.IsInstanceValid(GodotObject?),
GodotObject.WeakRef(GodotObject?),
GodotObject.Dispose(),
GodotObject.Dispose(bool),
GodotObject.ToString(),
GodotObject.ToSignal(GodotObject, StringName),
GodotObject._Get(StringName),
GodotObject._GetPropertyList(),
GodotObject._IterGet(Variant),
GodotObject._IterInit(Array),
GodotObject._IterNext(Array),
GodotObject._Notification(int),
GodotObject._PropertyCanRevert(StringName),
GodotObject._PropertyGetRevert(StringName),
GodotObject._Set(StringName, Variant),
GodotObject._ValidateProperty(Dictionary),
GodotObject.Free(),
GodotObject.GetClass(),
GodotObject.IsClass(string),
GodotObject.Set(StringName, Variant),
GodotObject.Get(StringName),
GodotObject.SetIndexed(NodePath, Variant),
GodotObject.GetIndexed(NodePath),
GodotObject.GetPropertyList(),
GodotObject.GetMethodList(),
GodotObject.PropertyCanRevert(StringName),
GodotObject.PropertyGetRevert(StringName),
GodotObject.Notification(int, bool),
GodotObject.GetInstanceId(),
GodotObject.SetScript(Variant),
GodotObject.GetScript(),
GodotObject.SetMeta(StringName, Variant),
GodotObject.RemoveMeta(StringName),
GodotObject.GetMeta(StringName, Variant),
GodotObject.HasMeta(StringName),
GodotObject.GetMetaList(),
GodotObject.AddUserSignal(string, Array),
GodotObject.HasUserSignal(StringName),
GodotObject.RemoveUserSignal(StringName),
GodotObject.EmitSignal(StringName, params Variant[]),
GodotObject.EmitSignal(StringName, ReadOnlySpan<Variant>),
GodotObject.Call(StringName, params Variant[]),
GodotObject.Call(StringName, ReadOnlySpan<Variant>),
GodotObject.CallDeferred(StringName, params Variant[]),
GodotObject.CallDeferred(StringName, ReadOnlySpan<Variant>),
GodotObject.SetDeferred(StringName, Variant),
GodotObject.Callv(StringName, Array),
GodotObject.HasMethod(StringName),
GodotObject.GetMethodArgumentCount(StringName),
GodotObject.HasSignal(StringName),
GodotObject.GetSignalList(),
GodotObject.GetSignalConnectionList(StringName),
GodotObject.GetIncomingConnections(),
GodotObject.Connect(StringName, Callable, uint),
GodotObject.Disconnect(StringName, Callable),
GodotObject.IsConnected(StringName, Callable),
GodotObject.HasConnections(StringName),
GodotObject.SetBlockSignals(bool),
GodotObject.IsBlockingSignals(),
GodotObject.NotifyPropertyListChanged(),
GodotObject.SetMessageTranslation(bool),
GodotObject.CanTranslateMessages(),
GodotObject.Tr(StringName, StringName),
GodotObject.TrN(StringName, StringName, int, StringName),
GodotObject.GetTranslationDomain(),
GodotObject.SetTranslationDomain(StringName),
GodotObject.IsQueuedForDeletion(),
GodotObject.CancelFree(),
GodotObject.EmitSignalScriptChanged(),
GodotObject.EmitSignalPropertyListChanged(),
GodotObject.InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant),
GodotObject.HasGodotClassMethod(in godot_string_name),
GodotObject.HasGodotClassSignal(in godot_string_name),
GodotObject.NativeInstance,
GodotObject.ScriptChanged,
GodotObject.PropertyListChanged,
object.Equals(object?),
object.Equals(object?, object?),
object.GetHashCode(),
object.GetType(),
object.MemberwiseClone(),
object.ReferenceEquals(object?, object?),
object.ToString()

Extension Methods

NodeExtensions.FindNodeOfType<T>(Node)

Remarks

O BattleController é responsável por gerenciar o fluxo geral da batalha, incluindo a inicialização, transições de estado e configuração.

Transições de estadosPrincipais transições de estado da batalha
Setup da batalhaConfiguração inicial da batalha

Properties

CurrentRound

public int CurrentRound { get; }

Property Value

int

CurrentState

public BattleState CurrentState { get; }

Property Value

BattleState

EnemyCharacterStore

[Export(PropertyHint.None, "")]
public CharacterStore? EnemyCharacterStore { get; set; }

Property Value

CharacterStore?

EnemyGridPosition

[Export(PropertyHint.Range, "-10,10,1")]
public Vector3 EnemyGridPosition { get; set; }

Property Value

Vector3

EnemySquadLocation

[Export(PropertyHint.None, "")]
public LocationType? EnemySquadLocation { get; set; }

Property Value

LocationType?

GridEntityScene

[Export(PropertyHint.None, "")]
public PackedScene? GridEntityScene { get; set; }

Property Value

PackedScene?

Instance

public static BattleController Instance { get; }

Property Value

BattleController

PlayerCharacterStore

[Export(PropertyHint.None, "")]
public CharacterStore? PlayerCharacterStore { get; set; }

Property Value

CharacterStore?

PlayerGridPosition

[Export(PropertyHint.Range, "-10,10,1")]
public Vector3 PlayerGridPosition { get; set; }

Property Value

Vector3

PlayerSquadLocation

[Export(PropertyHint.None, "")]
public LocationType? PlayerSquadLocation { get; set; }

Property Value

LocationType?

RecreateGrids

[ExportToolButton("Recreate Grids")]
public Callable RecreateGrids { get; }

Property Value

Callable

Methods

AdvanceRound()

public void AdvanceRound()

GetAllCharacters()

public Array GetAllCharacters()

Returns

Array

GetEnemyTeam()

public List<CharacterType> GetEnemyTeam()

Returns

List<CharacterType>

GetPlayerTeam()

public List<CharacterType> GetPlayerTeam()

Returns

List<CharacterType>

LogLocationInfo(string?)

public void LogLocationInfo(string? context)

Parameters

context string?

LogTeamInfo(string)

public void LogTeamInfo(string context)

Parameters

context string

PauseBattle()

public static void PauseBattle()

ResumeBattle()

public static void ResumeBattle()

SetBattleState(BattleState)

public void SetBattleState(BattleState newState)

Parameters

newState BattleState

StartBattle(Array?, Array?)

public void StartBattle(Array? playerTeam = null, Array? enemyTeam = null)

Parameters

playerTeam Array?

enemyTeam Array?

TransitionToRounds()

public void TransitionToRounds()

_Ready()

Called when the node is "ready", i.e. when both the node and its children have entered the scene tree. If the node has children, their callbacks get triggered first, and the parent node will receive the ready notification afterwards. Corresponds to the notification in . See also the @onready annotation for variables. Usually used for initialization. For even earlier initialization, may be used. See also . Note: This method may be called only once for each node. After removing a node from the scene tree and adding it again, will not be called a second time. This can be bypassed by requesting another call with , which may be called anywhere before adding the node again.

public override void _Ready()

Tem uma sugestão? 💡