|
|
@@ -5,6 +5,8 @@ using Sirenix.OdinInspector;
|
|
|
|
|
|
public class WaterSprite : Boss
|
|
|
{
|
|
|
+ public int attackCount = 0;
|
|
|
+ public float comboInterval;
|
|
|
public enum AttackMethods
|
|
|
{
|
|
|
Move, //移动,浮空+点水,动画控制高度,代码控制位移x;点水处生化
|
|
|
@@ -67,7 +69,6 @@ public class WaterSprite : Boss
|
|
|
private float pastPoliTime; //已经过去的蝌蚪时间
|
|
|
|
|
|
[Header("变化阶段")]
|
|
|
- [LabelText("转阶段的生命比例")] public float hpRadioOfPhase;
|
|
|
[LabelText("愤怒状态攻击间隔")] public float angryAttackInterval;
|
|
|
[LabelText("愤怒状态持续时间")] public float angryDuration;
|
|
|
private float angryTimer;
|
|
|
@@ -146,8 +147,8 @@ public class WaterSprite : Boss
|
|
|
{
|
|
|
Debug.Log("退出愤怒状态");
|
|
|
isAngry = false;
|
|
|
- ChangeCirculate(0);
|
|
|
bodyTrans.gameObject.SetActive(true);
|
|
|
+ ChangeCirculate(2);
|
|
|
}
|
|
|
}
|
|
|
if(!isHoldingUmbre) attack.OnBlackUmbrella();
|
|
|
@@ -179,27 +180,30 @@ public class WaterSprite : Boss
|
|
|
int[] powers = new int[attacks.Length];
|
|
|
for (int i = 0; i < attacks.Length; i++)
|
|
|
{
|
|
|
+ if (curAttackType == AttackMethods.Umbrella && !isHoldingUmbre && attacks[i].attack == AttackMethods.Umbrella)
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
powers[i] = attacks[i].weight;
|
|
|
}
|
|
|
- //int a = RandomWithWeight(powers);
|
|
|
- //curAttackType = attacks[a].attack;
|
|
|
-
|
|
|
- bool result = false;
|
|
|
- while (!result)
|
|
|
+ int a = RandomWithWeight(powers);
|
|
|
+ curAttackType = attacks[a].attack;
|
|
|
+ attackCount = 1;
|
|
|
+ switch (curAttackType)
|
|
|
{
|
|
|
- int a = RandomWithWeight(powers);
|
|
|
- curAttackType = attacks[a].attack;
|
|
|
- result = true;
|
|
|
- if (curAttackType == AttackMethods.Umbrella && !isHoldingUmbre)
|
|
|
- {
|
|
|
- result = false;
|
|
|
- }
|
|
|
+ case AttackMethods.Hair:
|
|
|
+ if (bossPhase == 2) attackCount = Random.Range(1, 3);
|
|
|
+ break;
|
|
|
+ case AttackMethods.Shoot:
|
|
|
+ if (bossPhase == 2) attackCount = Random.Range(1, 3);
|
|
|
+ if (bossPhase == 2) attackCount = Random.Range(2, 4);
|
|
|
+ break;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
public override void Attack()
|
|
|
{
|
|
|
+ attackCount--;
|
|
|
switch (curAttackType)
|
|
|
{
|
|
|
case AttackMethods.Move:
|
|
|
@@ -253,6 +257,7 @@ public class WaterSprite : Boss
|
|
|
RandomAttackState();
|
|
|
break;
|
|
|
case 2:
|
|
|
+ ChangeCirculate(3);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
@@ -265,6 +270,77 @@ public class WaterSprite : Boss
|
|
|
umbrella.SetActive(false);
|
|
|
}
|
|
|
}
|
|
|
+ public override void OnState()
|
|
|
+ {
|
|
|
+ switch (state)
|
|
|
+ {
|
|
|
+ case CharacterState.Idle:
|
|
|
+ if (isToBossRoom)
|
|
|
+ {
|
|
|
+ OnChangeBG();
|
|
|
+ }
|
|
|
+ else if(attackCount > 0)
|
|
|
+ {
|
|
|
+ curInterval -= Time.deltaTime;
|
|
|
+ if (curInterval <= 0)
|
|
|
+ {
|
|
|
+ //Debug.Log("触发连招");
|
|
|
+ ChangeState(CharacterState.Attack);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (bossState != BossState.weak)
|
|
|
+ {
|
|
|
+ //Debug.Log(curInterval);
|
|
|
+ curInterval -= Time.deltaTime;
|
|
|
+ if (curInterval <= 0)
|
|
|
+ {
|
|
|
+ RandomAttackState();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case CharacterState.Run:
|
|
|
+ OnMove();
|
|
|
+ break;
|
|
|
+ case CharacterState.Attack:
|
|
|
+ OnAttack();
|
|
|
+ break;
|
|
|
+ case CharacterState.HitStun:
|
|
|
+ hitFeedbackSystem.HitStunUpdate();
|
|
|
+ break;
|
|
|
+ case CharacterState.SpecialStatus_Float:
|
|
|
+ attributeStatus.SpecialStateEffect(SpecialState.FloatState);
|
|
|
+ break;
|
|
|
+ case CharacterState.SpecialStatus_BlowUp:
|
|
|
+ attributeStatus.SpecialStateEffect(SpecialState.BlownUp);
|
|
|
+ break;
|
|
|
+ case CharacterState.SpecialStatus_ShotDown:
|
|
|
+ attributeStatus.SpecialStateEffect(SpecialState.ShotDown);
|
|
|
+ break;
|
|
|
+ case CharacterState.SpecialStatus_Weak:
|
|
|
+ attributeStatus.SpecialStateEffect(SpecialState.Weak);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (isInBossRoom)
|
|
|
+ {
|
|
|
+ changeBackTime += Time.deltaTime;
|
|
|
+ if (changeBackTime >= toOrigNeedTime)
|
|
|
+ {
|
|
|
+ ChangeBG(false);
|
|
|
+ changeBackTime = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ OnBossState();
|
|
|
+ if (stage < hpRadio.Length)
|
|
|
+ {
|
|
|
+ if ((float)hp / (float)totalHp < hpRadio[stage])
|
|
|
+ {
|
|
|
+ stage++;
|
|
|
+ DropSouls();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
public override void OnAttack()
|
|
|
{
|
|
|
@@ -300,7 +376,7 @@ public class WaterSprite : Boss
|
|
|
}
|
|
|
attack.KunaiAttack((pc.transform.position - pws.transform.position).normalized, num);
|
|
|
BodyFlickerAppear();
|
|
|
- ChangeState(CharacterState.Run);
|
|
|
+ EndCurAttackState(true);
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
|
@@ -311,8 +387,8 @@ public class WaterSprite : Boss
|
|
|
#region 瞬身相关
|
|
|
public void BodyFlickerDisappear()
|
|
|
{
|
|
|
- if (isDisappear) return;
|
|
|
- Debug.Log("瞬身开始");
|
|
|
+ if (isDisappear || curBossStage == BossStage.polliwog) return;
|
|
|
+ //Debug.Log("瞬身开始");
|
|
|
bodyTrans.gameObject.SetActive(false);
|
|
|
PoolManager.Instantiate(smokeFx, transform.position);
|
|
|
ChangeBossState(BossState.invincible);
|
|
|
@@ -322,12 +398,28 @@ public class WaterSprite : Boss
|
|
|
|
|
|
public void BodyFlickerAppear()
|
|
|
{
|
|
|
- if (!isDisappear) return;
|
|
|
- Debug.Log("瞬身结束");
|
|
|
+ if (!isDisappear || curBossStage == BossStage.polliwog) return;
|
|
|
+ //Debug.Log("瞬身结束");
|
|
|
bodyTrans.gameObject.SetActive(true);
|
|
|
PoolManager.Instantiate(smokeFx, transform.position);
|
|
|
ChangeBossState(BossState.normal);
|
|
|
isDisappear = false;
|
|
|
}
|
|
|
+
|
|
|
+ public override void EndCurAttackState(bool hasIntervalTime)
|
|
|
+ {
|
|
|
+ //和下一个动作有没有间隔
|
|
|
+ if (hasIntervalTime)
|
|
|
+ {
|
|
|
+ if (attackCount <= 0)
|
|
|
+ {
|
|
|
+ if (bossPhase < statOfPhase.Length) curInterval = Random.Range(statOfPhase[bossPhase].minInterval, statOfPhase[bossPhase].maxInterval);
|
|
|
+ else Debug.LogError("没有配置该阶段属性");
|
|
|
+ }
|
|
|
+ else curInterval = comboInterval;
|
|
|
+ }
|
|
|
+ ChangeState(CharacterState.Idle);
|
|
|
+ ChangeBossState(BossState.rise);
|
|
|
+ }
|
|
|
#endregion
|
|
|
}
|