-
Notifications
You must be signed in to change notification settings - Fork 2
/
TestMutant.cs
89 lines (71 loc) · 2.42 KB
/
TestMutant.cs
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TestMutant : MonoBehaviour
{
public int moveSpeed;
public Animator testAnimator;
public Camera mainCamera;
public GameObject pointer;
public GameObject FireField;
Vector3 movePoint;
Ray ray;
GameObject hitBox;
// Start is called before the first frame update
void Start()
{
mainCamera = GameObject.Find("Main Camera").GetComponent<Camera>();
pointer = GameObject.Find("Pointer");
}
public void EndAttack()
{
}
// Update is called once per frame
void Update()
{
ray = mainCamera.ScreenPointToRay(Input.mousePosition);
float hAxis = Input.GetAxisRaw("Horizontal");
float vAxis = Input.GetAxisRaw("Vertical");
Vector3 moveVec = new Vector3(hAxis, 0, vAxis).normalized;
if (Physics.Raycast(ray, out RaycastHit raycastHit, 300.0f, 1 << 8))
{
movePoint = raycastHit.point;
pointer.transform.position = raycastHit.point;
}
if (Input.GetMouseButtonDown(1) && !testAnimator.GetBool("isAttack"))
{
Quaternion a = Quaternion.identity;
a.SetLookRotation(movePoint - transform.position);
transform.rotation = a;
testAnimator.SetTrigger("Attack");
}
if (Input.GetKey(KeyCode.E) && !testAnimator.GetBool("isJumpSkill"))
{
Quaternion a = Quaternion.identity;
a.SetLookRotation(movePoint - transform.position);
transform.rotation = a;
testAnimator.SetTrigger("JumpSkill");
Instantiate(FireField).transform.position = movePoint;
}
//if (!testAnimator.GetBool("isJumpSkill"))
//if(Input.GetMouseButton(1))
{
if (moveVec.magnitude > 0)
{
testAnimator.SetBool("isRun", true);
transform.position += moveVec * moveSpeed * Time.deltaTime;
Debug.Log(moveVec);
if (!testAnimator.GetBool("isJumpSkill") && !testAnimator.GetBool("isAttack"))
{
Quaternion a = Quaternion.identity;
a.SetLookRotation(moveVec);
transform.rotation = a;
}
}
else
{
testAnimator.SetBool("isRun", false);
}
}
}
}