|
|
@@ -19,6 +19,10 @@ public class ESpirits_Cook : MonoBehaviour
|
|
|
public float walkSpeed; //走路速度
|
|
|
public float runSpeed; //冲刺速度
|
|
|
|
|
|
+ private float intervalTimePast;
|
|
|
+ public float intervalTimeSell; //卖串的间隔时间
|
|
|
+ private bool isInterval = false; //开始计算间隔时间
|
|
|
+
|
|
|
public float minX; //厨子卖串的最小地址站
|
|
|
public float maxX; //厨子卖串的最大地址站
|
|
|
|
|
|
@@ -93,12 +97,13 @@ public class ESpirits_Cook : MonoBehaviour
|
|
|
//路过发串
|
|
|
if (state == cookState.sell && !die && (other.gameObject.layer == 7 || other.gameObject.layer == 8 || other.gameObject.layer == 6))
|
|
|
{
|
|
|
- if (chuan > 0)
|
|
|
+ if (!isInterval && chuan > 0)
|
|
|
{
|
|
|
GameObject ga = other.transform.parent.parent.parent.gameObject;
|
|
|
Character ca = ga.GetComponent<Character>();
|
|
|
if (!ca.cooks.Exists(T => T == gameObject))
|
|
|
{
|
|
|
+ isInterval = true;
|
|
|
chuan -= 1;
|
|
|
text.text = chuan.ToString();
|
|
|
ani.Play("attack_march", 0, 0);
|
|
|
@@ -290,5 +295,14 @@ public class ESpirits_Cook : MonoBehaviour
|
|
|
col.enabled = false;
|
|
|
ene.ChangeState(CharacterState.Die);
|
|
|
}
|
|
|
+ if (isInterval)
|
|
|
+ {
|
|
|
+ intervalTimePast += Time.deltaTime;
|
|
|
+ if (intervalTimePast >= intervalTimeSell)
|
|
|
+ {
|
|
|
+ intervalTimePast = 0;
|
|
|
+ isInterval = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|