|
|
@@ -58,8 +58,9 @@ public class WolfHuntGameMode : ChallengeGameMode
|
|
|
float baseCreateDistance = 25;
|
|
|
// float baseCreateDistance = 15;
|
|
|
float plusCreateDistance = 0;
|
|
|
-
|
|
|
+ public bool banCreateAnimal = false;
|
|
|
void CreateAnimal() {
|
|
|
+ if (banCreateAnimal) return;
|
|
|
if (animalCreateIndex >= animalCreateList.Length) return;
|
|
|
int animalStyleID = animalCreateList[animalCreateIndex++];
|
|
|
|
|
|
@@ -82,6 +83,7 @@ public class WolfHuntGameMode : ChallengeGameMode
|
|
|
wolf.transform.position = newPos;
|
|
|
|
|
|
wolf.hp = animalStyleID == 1 ? 5 : 8;
|
|
|
+ wolf.onlineHandler.uid = animalCreateIndex + 1;
|
|
|
wolf.ChangeColorByType(animalStyleID);
|
|
|
wolf.RotateByWorldY(Random.value * 360);
|
|
|
wolf.onDie += delegate(Wolf wf) {
|
|
|
@@ -99,9 +101,12 @@ public class WolfHuntGameMode : ChallengeGameMode
|
|
|
public override void Update()
|
|
|
{
|
|
|
base.Update();
|
|
|
+ CheckAutoCreateAnimalByUpdate(Time.deltaTime);
|
|
|
+ }
|
|
|
+ public void CheckAutoCreateAnimalByUpdate(float dt) {
|
|
|
//固定时间间隔生成一头狼
|
|
|
if (!gameMgr.gameOver && canStartCreateAniaml) {
|
|
|
- createAnimalCountDown -= Time.deltaTime;
|
|
|
+ createAnimalCountDown -= dt;
|
|
|
if (createAnimalCountDown <= 0) {
|
|
|
createAnimalCountDown = createAnimalCountDownDefault;
|
|
|
CreateAnimal();
|
|
|
@@ -119,6 +124,7 @@ public class WolfHuntGameMode : ChallengeGameMode
|
|
|
public int hp = 20;
|
|
|
public int hpMax = 20;
|
|
|
public System.Action onHpZero;
|
|
|
+ public System.Action onHurtEffect;
|
|
|
public void OnAttacked(Wolf wolf, int hurtValue) {
|
|
|
if (hp <= 0) return;
|
|
|
|
|
|
@@ -132,6 +138,7 @@ public class WolfHuntGameMode : ChallengeGameMode
|
|
|
hp -= hurtValue;
|
|
|
AudioMgr.ins.PlayAnimalEffect("man_injured", AudioMgr.GetAudioSource(this.gameMgr.gameObject));
|
|
|
DoTweenHurt();
|
|
|
+ onHurtEffect?.Invoke();
|
|
|
if (hp <= 0) {
|
|
|
hp = 0;
|
|
|
if (onHpZero == null) {
|
|
|
@@ -188,7 +195,7 @@ public class WolfHuntGameMode : ChallengeGameMode
|
|
|
}
|
|
|
|
|
|
public void QuicklyCreateAnimalForDebug() {
|
|
|
- baseCreateDistance = 11;
|
|
|
- createAnimalCountDownDefault = 5;
|
|
|
+ baseCreateDistance = 15;
|
|
|
+ createAnimalCountDownDefault = 10;
|
|
|
}
|
|
|
}
|