View difference between Paste ID: WE6Q5XeX and UG14PyTB
SHOW: | | - or go back to the newest paste.
1
using UnityEngine;
2
3
public class UsageSample : MonoBehaviour
4
{
5
    void Update()
6
    {
7
		//Empty input direction
8-
		Vector2 dir = Vector2.zero;
8+
		Vector2 direction = Vector2.zero;
9
		//Set direction base on when press key of action
10
		if(Input.GetKey(KeyManager.i.Up)) dir.y = 1;
11
		if(Input.GetKey(KeyManager.i.Down)) dir.y = -1;
12
		if(Input.GetKey(KeyManager.i.Left)) dir.x = -1;
13
		if(Input.GetKey(KeyManager.i.Right)) dir.x = 1;
14
    }
15
}