-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
namespace App.Battle.Interfaces | ||
{ | ||
public interface IBattleState | ||
{ | ||
public void IncreaseIndex(); | ||
public void DecreaseIndex(); | ||
public IBattleState Execute(); | ||
public IBattleState Cancel(); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace App.Battle.Interfaces.Presenters | ||
{ | ||
public interface IBattleStateMachinePresenter | ||
{ | ||
public void IncreaseIndex(); | ||
public void DecreaseIndex(); | ||
public void Execute(); | ||
public void Cancel(); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace App.Battle.Interfaces.UseCases | ||
{ | ||
public interface IBattleStateMachineUseCase | ||
{ | ||
public void IncreaseIndex(); | ||
public void DecreaseIndex(); | ||
public void Execute(); | ||
public void Cancel(); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
using App.Battle.Interfaces; | ||
|
||
namespace App.Battle.Presenters | ||
{ | ||
public class BattleStateFirstPresenter : IBattleState | ||
{ | ||
private int _nextStateNumber = 3; | ||
private int _nextStateIndex = 0; | ||
|
||
public void IncreaseIndex() | ||
{ | ||
if(_nextStateIndex < _nextStateNumber - 1) | ||
{ | ||
_nextStateIndex++; | ||
} | ||
UnityEngine.Debug.Log($"CurrentIndex: {_nextStateIndex}"); | ||
} | ||
|
||
public void DecreaseIndex() | ||
{ | ||
if(_nextStateIndex > 0) | ||
{ | ||
_nextStateIndex--; | ||
} | ||
UnityEngine.Debug.Log($"CurrentIndex: {_nextStateIndex}"); | ||
} | ||
|
||
public IBattleState Execute() | ||
{ | ||
switch(_nextStateIndex) | ||
{ | ||
case 0: | ||
UnityEngine.Debug.Log("CurrentState: Select Skill"); | ||
return new BattleStateSkillsPresenter(); | ||
case 1: | ||
UnityEngine.Debug.Log("CurrentState: Select Command"); | ||
return this; | ||
case 2: | ||
UnityEngine.Debug.Log("CurrentState: Select Item"); | ||
return new BattleStateItemsPresenter(); | ||
} | ||
return null; | ||
} | ||
|
||
public IBattleState Cancel() | ||
{ | ||
UnityEngine.Debug.Log("CurrentState: Select Command"); | ||
return this; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
using App.Battle.Interfaces; | ||
|
||
namespace App.Battle.Presenters | ||
{ | ||
public class BattleStateItemsPresenter : IBattleState | ||
{ | ||
public void IncreaseIndex() | ||
{ | ||
UnityEngine.Debug.Log("CurrentIndex: 0"); | ||
return; | ||
} | ||
|
||
public void DecreaseIndex() | ||
{ | ||
UnityEngine.Debug.Log("CurrentIndex: 0"); | ||
return; | ||
} | ||
|
||
public IBattleState Execute() | ||
{ | ||
UnityEngine.Debug.Log("CurrentState: Select Target(Item)"); | ||
return new BattleStateItemsTargetPresenter(); | ||
} | ||
|
||
public IBattleState Cancel() | ||
{ | ||
UnityEngine.Debug.Log("CurrentState: Select Command"); | ||
return new BattleStateFirstPresenter(); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
using App.Battle.Interfaces; | ||
|
||
namespace App.Battle.Presenters | ||
{ | ||
public class BattleStateItemsTargetPresenter : IBattleState | ||
{ | ||
|
||
public void IncreaseIndex() | ||
{ | ||
UnityEngine.Debug.Log("CurrentIndex: 0"); | ||
return; | ||
} | ||
|
||
public void DecreaseIndex() | ||
{ | ||
UnityEngine.Debug.Log("CurrentIndex: 0"); | ||
return; | ||
} | ||
|
||
public IBattleState Execute() | ||
{ | ||
UnityEngine.Debug.Log("CurrentState: Select Item"); | ||
return new BattleStateItemsPresenter(); | ||
} | ||
|
||
public IBattleState Cancel() | ||
{ | ||
UnityEngine.Debug.Log("CurrentState: Select Item"); | ||
return new BattleStateItemsPresenter(); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
using App.Battle.Interfaces; | ||
using App.Battle.Interfaces.Presenters; | ||
|
||
namespace App.Battle.Presenters | ||
{ | ||
public class BattleStateMachinePresenter : IBattleStateMachinePresenter | ||
{ | ||
private IBattleState _currentState = new BattleStateFirstPresenter(); | ||
|
||
public void IncreaseIndex() | ||
{ | ||
if(_currentState == null) | ||
{ | ||
throw new System.Exception("CurrentState is null"); | ||
} | ||
_currentState.IncreaseIndex(); | ||
} | ||
|
||
public void DecreaseIndex() | ||
{ | ||
if(_currentState == null) | ||
{ | ||
throw new System.Exception("CurrentState is null"); | ||
} | ||
_currentState.DecreaseIndex(); | ||
} | ||
|
||
public void Execute() | ||
{ | ||
if(_currentState == null) | ||
{ | ||
throw new System.Exception("CurrentState is null"); | ||
} | ||
_currentState = _currentState.Execute(); | ||
} | ||
|
||
public void Cancel() | ||
{ | ||
_currentState = _currentState.Cancel(); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
using App.Battle.Interfaces; | ||
|
||
namespace App.Battle.Presenters | ||
{ | ||
public class BattleStateSkillsPresenter : IBattleState | ||
{ | ||
public void IncreaseIndex() | ||
{ | ||
UnityEngine.Debug.Log("CurrentIndex: 0"); | ||
return; | ||
} | ||
|
||
public void DecreaseIndex() | ||
{ | ||
UnityEngine.Debug.Log("CurrentIndex: 0"); | ||
return; | ||
} | ||
|
||
public IBattleState Execute() | ||
{ | ||
UnityEngine.Debug.Log("CurrentState: Select Target(Skill)"); | ||
return new BattleStateSkillsTargetPresenter(); | ||
} | ||
|
||
public IBattleState Cancel() | ||
{ | ||
UnityEngine.Debug.Log("CurrentState: Select Command"); | ||
return new BattleStateFirstPresenter(); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
using App.Battle.Interfaces; | ||
|
||
namespace App.Battle.Presenters | ||
{ | ||
public class BattleStateSkillsTargetPresenter : IBattleState | ||
{ | ||
public void IncreaseIndex() | ||
{ | ||
UnityEngine.Debug.Log("CurrentIndex: 0"); | ||
return; | ||
} | ||
|
||
public void DecreaseIndex() | ||
{ | ||
UnityEngine.Debug.Log("CurrentIndex: 0"); | ||
return; | ||
} | ||
|
||
public IBattleState Execute() | ||
{ | ||
UnityEngine.Debug.Log("CurrentState: Select Command"); | ||
return new BattleStateFirstPresenter(); | ||
} | ||
|
||
public IBattleState Cancel() | ||
{ | ||
UnityEngine.Debug.Log("CurrentState: Select Skill"); | ||
return new BattleStateSkillsPresenter(); | ||
} | ||
} | ||
} |