summaryrefslogtreecommitdiff
path: root/Assets/Scripts/Input/InputManager.cs
blob: fadf355646ba201d801f9c1263e0bb9a80f66823 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

// 处理输入逻辑,不涉及读取输入,只处理逻辑
public class InputManager : SingletonMB<InputManager>
{

	PCController _pc;

	PCController pc
	{
		get
		{
			if (_pc == null)
				_pc = PCController.instance;
			return _pc;
		}
	}

	public void OnMoveRight()
	{
		UnitState.MoveParam move = new UnitState.MoveParam();
		move.isRight = true;
		move.key = "d";
		pc.unitState.ChangeState(UnitState.EUnitState.Move, move);
	}

	public void OnMoveLeft()
	{
		UnitState.MoveParam move = new UnitState.MoveParam();
		move.isRight = false;
		move.key = "a";
		pc.unitState.ChangeState(UnitState.EUnitState.Move, move);
	}

	public void OnTurnBack()
	{

	}

	public void OnJump()
	{
		pc.unitState.ChangeState(UnitState.EUnitState.Jump, new UnitState.JumpParam());
	}

	public void OnAttack()
	{
		pc.unitState.ChangeState(UnitState.EUnitState.Skill, new UnitState.SkillParam());
	}

}