|
|
@@ -31,8 +31,8 @@ public class ESpirits_Cook : MonoBehaviour
|
|
|
|
|
|
private Enemy ene; //厨子的enemy脚本
|
|
|
|
|
|
- private bool once = false; //死一次
|
|
|
- private bool die = false; //厨子命尽
|
|
|
+ //private bool once = false; //死一次
|
|
|
+ //private bool die = false; //厨子命尽
|
|
|
//private bool toCatch = false; //没串了去抓人
|
|
|
private bool isRunning = false; //开跑
|
|
|
|
|
|
@@ -60,12 +60,11 @@ public class ESpirits_Cook : MonoBehaviour
|
|
|
public enum cookState
|
|
|
{
|
|
|
sell = 0,
|
|
|
- walk = 1,
|
|
|
- find = 2,
|
|
|
- run = 3,
|
|
|
+ run = 1,
|
|
|
+ seize = 2, //抓住
|
|
|
+ back = 3,
|
|
|
cook = 4,
|
|
|
- back = 5,
|
|
|
- first = 6, //刚出生
|
|
|
+ first = 5, //刚出生
|
|
|
}
|
|
|
|
|
|
private cookState state;
|
|
|
@@ -95,7 +94,7 @@ public class ESpirits_Cook : MonoBehaviour
|
|
|
private void OnTriggerEnter(Collider other)
|
|
|
{
|
|
|
//路过发串
|
|
|
- if (state == cookState.sell && !die && (other.gameObject.layer == 7 || other.gameObject.layer == 8 || other.gameObject.layer == 6))
|
|
|
+ if (state == cookState.sell && (other.gameObject.layer == 7 || other.gameObject.layer == 8 || other.gameObject.layer == 6))
|
|
|
{
|
|
|
if (!isInterval && chuan > 0)
|
|
|
{
|
|
|
@@ -113,36 +112,37 @@ public class ESpirits_Cook : MonoBehaviour
|
|
|
//Instantiate(effect, ga.transform.position, new Quaternion(0, 0, 0, 0), ga.transform);
|
|
|
if (chuan == 0)
|
|
|
{
|
|
|
+ ani.Play("charge", 0, 0);
|
|
|
//toCatch = true;
|
|
|
- ChangeState(cookState.walk);
|
|
|
+ ChangeState(cookState.run);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//抓人
|
|
|
- else if (state == cookState.run || state == cookState.find || state == cookState.walk && !once)
|
|
|
+ else if (state == cookState.run)
|
|
|
{
|
|
|
if (other.gameObject.layer == 6 || other.gameObject.layer == 7)
|
|
|
{
|
|
|
food = other.transform.parent.parent.parent.gameObject;
|
|
|
if (food.layer == 7 && !food.GetComponent<Demonic>().isDie)
|
|
|
{
|
|
|
- food.GetComponent<Demonic>().ChangeState(CharacterState.Die);
|
|
|
+ food.GetComponent<Demonic>().ChangeState(CharacterState.Coma);
|
|
|
//cookKillEffect.SetActive(true);
|
|
|
- ChangeState(cookState.cook);
|
|
|
+ ChangeState(cookState.seize);
|
|
|
}
|
|
|
else if (food.layer == 6 && !food.GetComponent<PlayerController>().isDie)
|
|
|
{
|
|
|
- food.GetComponent<PlayerController>().ChangeState(CharacterState.Die);
|
|
|
+ food.GetComponent<PlayerController>().ChangeState(CharacterState.Coma);
|
|
|
//cookKillEffect.SetActive(true);
|
|
|
- ChangeState(cookState.cook);
|
|
|
+ ChangeState(cookState.seize);
|
|
|
}
|
|
|
chuan = food.GetComponent<Character>().cookNum;
|
|
|
text.text = chuan.ToString();
|
|
|
}
|
|
|
}
|
|
|
//回家卖串
|
|
|
- else if (state == cookState.back && !die && other.gameObject.layer == 8)
|
|
|
+ else if (state == cookState.back && other.gameObject.layer == 8)
|
|
|
{
|
|
|
ChangeState(cookState.sell);
|
|
|
}
|
|
|
@@ -163,10 +163,9 @@ public class ESpirits_Cook : MonoBehaviour
|
|
|
g.SetActive(false);
|
|
|
}
|
|
|
break;
|
|
|
- //走路中
|
|
|
- case cookState.walk:
|
|
|
+ //冲刺中
|
|
|
+ case cookState.run:
|
|
|
dia.SetActive(false);
|
|
|
- //能被攻击
|
|
|
foreach (GameObject g in colliders)
|
|
|
{
|
|
|
g.SetActive(true);
|
|
|
@@ -174,21 +173,15 @@ public class ESpirits_Cook : MonoBehaviour
|
|
|
ene.canMove = true;
|
|
|
ene.ChangeState(CharacterState.Run);
|
|
|
break;
|
|
|
- //发现目标
|
|
|
- case cookState.find:
|
|
|
- ene.ChangeState(CharacterState.FindPlayer);
|
|
|
- break;
|
|
|
- //冲刺中
|
|
|
- case cookState.run:
|
|
|
- foreach (GameObject g in colliders)
|
|
|
- {
|
|
|
- g.SetActive(true);
|
|
|
- }
|
|
|
+ //抓住你啦
|
|
|
+ case cookState.seize:
|
|
|
+ ene.canMove = false;
|
|
|
break;
|
|
|
//鲨人中
|
|
|
case cookState.cook:
|
|
|
ene.canMove = false;
|
|
|
ani.Play("attack_march", 0, 0);
|
|
|
+ ChangeState(cookState.sell);
|
|
|
break;
|
|
|
//返回中
|
|
|
case cookState.back:
|
|
|
@@ -289,12 +282,6 @@ public class ESpirits_Cook : MonoBehaviour
|
|
|
{
|
|
|
StateAct(state);
|
|
|
}
|
|
|
- if (die && !once)
|
|
|
- {
|
|
|
- once = true;
|
|
|
- col.enabled = false;
|
|
|
- ene.ChangeState(CharacterState.Die);
|
|
|
- }
|
|
|
if (isInterval)
|
|
|
{
|
|
|
intervalTimePast += Time.deltaTime;
|