您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
29 行
615 B
29 行
615 B
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public enum JoyStickMode {
|
|
Motion,
|
|
LookAt,
|
|
}
|
|
|
|
public class FixedJoystick : Joystick
|
|
{
|
|
public static Vector2 motionDirection = Vector2.zero;
|
|
public static int lookDirection = 0;
|
|
|
|
[SerializeField] private JoyStickMode joyStickMode = 0;
|
|
|
|
private void Update()
|
|
{
|
|
if (joyStickMode == JoyStickMode.Motion)
|
|
{
|
|
motionDirection = Direction;
|
|
}
|
|
else
|
|
{
|
|
lookDirection = Direction.x == 0 ? 0 : Direction.x > 0 ? 1 : -1;
|
|
}
|
|
}
|
|
}
|