Commit 5d1b1fb4 authored by 16도재형's avatar 16도재형

MovingAttack available; need testing (#7)

parent e10f8e1f
......@@ -252,7 +252,7 @@ public class GameManager : MonoBehaviour {
mainCamera.transform.position = new Vector3(x, 6.75f, z);
}
// Camera controllings
// Camera controlls
void CameraMove(Vector3 vec)
{
mainCamera.transform.Translate(vec * cameraMoveSpeed * Time.deltaTime, Space.World);
......@@ -279,6 +279,7 @@ public class GameManager : MonoBehaviour {
public void MoveStateEnter()
{
// State change
if (onMoveState) return;
if (onAttackState) AttackStateExit();
if (onSkillState) SkillStateExit();
onMoveState = true;
......@@ -296,23 +297,61 @@ public class GameManager : MonoBehaviour {
}
void MoveStateExit()
{
onMoveState = false;
if (_parameterPoints == null)
return;
for (int i = 0; i < _parameterPoints.Length; i++)
{
if (_parameterPoints != null)
if (_parameterPoints[i] != null)
{
CivModel.Position pos = _parameterPoints[i].Value.Position;
_cells[pos.X, pos.Y].GetComponent<HexTile>().StopFlickering();
}
}
_parameterPoints = null;
onMoveState = false;
// TODO
}
public void AttackStateEnter()
{
// State change
if (onAttackState) return;
if (onMoveState) MoveStateExit();
if (onSkillState) SkillStateExit();
onAttackState = true;
// If _selectedActor cannot attack
if (_selectedActor.MovingAttackAct == null)
return;
// Select attackable adjacent tiles
_parameterPoints = _selectedActor.PlacedPoint.Value.Adjacents();
for (int i = 0; i < _parameterPoints.Length; i++)
{
if (_selectedActor.MovingAttackAct.IsActable(_parameterPoints[i]))
{
CivModel.Position pos = _parameterPoints[i].Value.Position;
_cells[pos.X, pos.Y].GetComponent<HexTile>().FlickerRed();
}
}
}
void AttackStateExit()
{
onAttackState = false;
// TODO
if (_parameterPoints == null)
return;
for (int i = 0; i < _parameterPoints.Length; i++)
{
if (_parameterPoints[i] != null)
{
CivModel.Position pos = _parameterPoints[i].Value.Position;
_cells[pos.X, pos.Y].GetComponent<HexTile>().StopFlickering();
}
}
_parameterPoints = null;
}
void SkillStateExit()
......
......@@ -130,7 +130,7 @@ public class UIManager : MonoBehaviour {
public void AttackActive()
{
SkillSet.SetActive(false);
GameManager.I.AttackStateEnter();
}
public void SkillSetActive()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment