/
PlayerParringCon.cs
116 lines (85 loc) · 3.14 KB
/
PlayerParringCon.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class PlayerParringCon : MonoBehaviour
{
// [SerializeField]
// BoxCollider playerSheildBoxCol;
PlayerSpCon playerSpConScript;
PlayerInputScript inputScript;
[SerializeField]
PlayerAniScript aniScript;
// 필요한지 확인.
[HideInInspector]
public bool isCool;
public bool isSucess;
float lastClickedTime = 0;
const float delay = 1f;
private void Start()
{
forTutorialMonsterCheckOnce = false;
isCool = false;
isSucess = false;
inputScript = GetComponent<PlayerInputScript>();
playerSpConScript = GetComponent<PlayerSpCon>();
}
private void Update()
{
if (lastClickedTime == 0 ) return;
if (Time.time - lastClickedTime > delay)
{
lastClickedTime = 0;
isCool = false;
isSucess = false;
inputScript.state = PlayerState.idle;
aniScript.playerAniWait();
}
}
public void parringStart()
{
lastClickedTime = Time.time;
playerSpConScript.spDown();
isCool = true;
inputScript.state = PlayerState.parring;
aniScript.playerAniParring();
}
bool forTutorialMonsterCheckOnce;
private void OnTriggerEnter(Collider other)
{
if(other.gameObject.name == "CloseAttackEnemy01")
{
CloseAttackTypeNormalColliderCon con = other.GetComponent<CloseAttackTypeNormalColliderCon>();
isSucess = con.isStun;
return;
}
// 튜토리얼용
if ((other.gameObject.name == "TutorialEnemy01(Clone)")
&& (SceneManager.GetActiveScene().name == "Tutorial_Scene_Ver2")
&& (forTutorialMonsterCheckOnce == false))
{
TutorialManagerVer2 tutorialManagerScript = GameObject.Find("TutorialManagerVer2").GetComponent<TutorialManagerVer2>();
if (tutorialManagerScript.tutorial != TutorialStateVer2.step03_6) return;
CloseAttackTypeNormalColliderCon con = other.GetComponent<CloseAttackTypeNormalColliderCon>();
isSucess = con.isStun;
switch (isSucess)
{
case true:
tutorialManagerScript.tutorial = TutorialStateVer2.step03_7;
TutorialTypeMonsterMove tutorialMonsterMoveScript = other.GetComponent<TutorialTypeMonsterMove>();
tutorialMonsterMoveScript.state = TutorialEnemyState.getWait;
forTutorialMonsterCheckOnce = true;
break;
}
return;
}
// 튜토리얼 + 일반 전투용
if ((other.gameObject.name == "TutorialEnemy01(Clone)")
&& (SceneManager.GetActiveScene().name == "Tutorial_Scene_Ver2"))
{
CloseAttackTypeNormalColliderCon con = other.GetComponent<CloseAttackTypeNormalColliderCon>();
isSucess = con.isStun;
return;
}
}
}