public LivingPuzzleBlockAI(Enemy xEnemy) { this.enCurrentAction = LivingPuzzleBlockAI.Action.Sleeping; this.xOwner = xEnemy; if (Program.game.xStateMaster.enGameMode == StateMaster.GameModes.RogueLike) { this.fAggroDistance = 1000f; } }
private void ChangeAction(LivingPuzzleBlockAI.Action enChangeTo) { this.enCurrentAction = enChangeTo; this.sSubAction = ""; }
public override void OnUpdate() { if (this.bIncapacitated) { return; } this.iCounter++; this.iNextHardUpdate--; this.iExistCounter++; if (this.bGonnaDie) { return; } if (this.sSubAction == "Wait") { if (this.iCounter < 0) { return; } this.sSubAction = ""; } if (this.enCurrentAction == LivingPuzzleBlockAI.Action.Sleeping) { if (this.iCounter == 60) { this.xOwner.xRenderComponent.SwitchAnimation(1); return; } if (this.iCounter == 120) { this.enCurrentAction = LivingPuzzleBlockAI.Action.Chillin; this.iCounter = 0; return; } } else if (this.enCurrentAction == LivingPuzzleBlockAI.Action.Chillin) { if (this.xPlayerLockedOnto == null) { float fMos; this.xPlayerLockedOnto = base.FindTarget(EnemyBehaviour.TargetSearchParameters.Closest, 300f, out fMos); } int iActionAt = 70 - CAS.DifficultyModifier * 10; if (this.iCounter == iActionAt) { int iSuperJumpCooldown = (int)MathHelper.Max(300f, 140f); if (this.iLastSuperJumpAt < this.iExistCounter - iSuperJumpCooldown) { this.enCurrentAction = LivingPuzzleBlockAI.Action.SuperJumpPrepare; this.iCounter = 0; this.xOwner.xRenderComponent.SwitchAnimation(6); this.iLastSuperJumpAt = this.iExistCounter; return; } this.enCurrentAction = LivingPuzzleBlockAI.Action.JumpPrepare; this.iCounter = 0; this.xOwner.xRenderComponent.SwitchAnimation(3); return; } } else if (this.enCurrentAction == LivingPuzzleBlockAI.Action.JumpTraveling) { Vector2 v2PerTick = (this.v2JumpTarget - this.v2JumpOrigin) / 24f; this.xOwner.xTransform.v2Pos += v2PerTick; if (this.iCounter == 24) { this.enCurrentAction = LivingPuzzleBlockAI.Action.JumpWaitForAttack; this.iCounter = 0; return; } } else if (this.enCurrentAction == LivingPuzzleBlockAI.Action.JumpWaitForAttack) { int iSmashDownAt = Math.Max(20 - CAS.DifficultyModifier * 3, 5); if (this.iCounter == iSmashDownAt) { this.enCurrentAction = LivingPuzzleBlockAI.Action.JumpAttack; Program.game._Enemy_EnterAttackAnimation(this.xOwner, 5); this.iCounter = 0; return; } } else if (this.enCurrentAction == LivingPuzzleBlockAI.Action.JumpAttack) { if (this.iCounter == 10) { this.enCurrentAction = LivingPuzzleBlockAI.Action.Chillin; this.iCounter = -10 + 7 * CAS.DifficultyModifier; this.sSubAction = "Wait"; return; } } else if (this.enCurrentAction == LivingPuzzleBlockAI.Action.SuperJumpTraveling) { Vector2 v2PerTick2 = (this.v2JumpTarget - this.v2JumpOrigin) / 24f; this.xOwner.xTransform.v2Pos += v2PerTick2; if (this.iCounter == 24) { this.enCurrentAction = LivingPuzzleBlockAI.Action.SuperJumpWaitForAttack; this.iCounter = 0; return; } } else if (this.enCurrentAction == LivingPuzzleBlockAI.Action.SuperJumpWaitForAttack) { int iSmashDownAt2 = Math.Max(20 - CAS.DifficultyModifier * 3, 5); if (this.iCounter == iSmashDownAt2) { this.enCurrentAction = LivingPuzzleBlockAI.Action.SuperJumpAttack; Program.game._Enemy_EnterAttackAnimation(this.xOwner, 8); this.iCounter = 0; return; } } else if (this.enCurrentAction == LivingPuzzleBlockAI.Action.SuperJumpAttack && this.iCounter == 10) { this.enCurrentAction = LivingPuzzleBlockAI.Action.Chillin; this.iCounter = -10; this.sSubAction = "Wait"; } }
public override void OnAnimationCallback(AnimationInstruction xIns) { if (CAS.NetworkRole == NetworkHelperInterface.NetworkRole.Client) { return; } if (xIns.xEvent.afAlterableValues[0] == 0f) { if (xIns.xEvent.afAlterableValues[1] == 0f) { float fMaxRange = (float)(50 + CAS.DifficultyModifier * 15); this.enCurrentAction = LivingPuzzleBlockAI.Action.JumpTraveling; this.iCounter = 0; this.xOwner.xCollisionComponent.DeactivateGroup(CollisionComponent.ColliderGroup.All); this.xOwner.xRenderComponent.SwitchAnimation(4); this.v2JumpOrigin = this.xOwner.xTransform.v2Pos; if (this.xPlayerLockedOnto == null) { this.v2JumpTarget = this.xOwner.xTransform.v2Pos + new Vector2(25f, 25f) * Utility.RandomizeVector2Direction(CAS.RandomInLogic); return; } float fDistance = Vector2.Distance(this.xOwner.xTransform.v2Pos, this.xPlayerLockedOnto.xTransform.v2Pos); if (fDistance > fMaxRange) { Vector2 v2Dir = Utility.Normalize(this.xPlayerLockedOnto.xTransform.v2Pos - this.xOwner.xTransform.v2Pos); this.v2JumpTarget = this.v2JumpOrigin + v2Dir * fMaxRange; return; } this.v2JumpTarget = this.xPlayerLockedOnto.xTransform.v2Pos; return; } else if (xIns.xEvent.afAlterableValues[1] == 1f) { if (this.enCurrentAction == LivingPuzzleBlockAI.Action.JumpTraveling) { this.enCurrentAction = LivingPuzzleBlockAI.Action.JumpWaitForAttack; this.iCounter = 0; return; } } else if (xIns.xEvent.afAlterableValues[1] == 2f) { Program.game.xCamera.SetShake(30); this.xOwner.xCollisionComponent.ActivateGroup(CollisionComponent.ColliderGroup.All); return; } } else if (xIns.xEvent.afAlterableValues[0] == 1f) { if (xIns.xEvent.afAlterableValues[1] == 0f) { float fMaxRange2 = (float)(70 + CAS.DifficultyModifier * 20); this.enCurrentAction = LivingPuzzleBlockAI.Action.SuperJumpTraveling; this.iCounter = 0; this.xOwner.xCollisionComponent.DeactivateGroup(CollisionComponent.ColliderGroup.All); this.xOwner.xRenderComponent.SwitchAnimation(7); this.v2JumpOrigin = this.xOwner.xTransform.v2Pos; if (this.xPlayerLockedOnto == null) { this.v2JumpTarget = this.xOwner.xTransform.v2Pos + new Vector2(25f, 25f) * Utility.RandomizeVector2Direction(CAS.RandomInLogic); return; } float fDistance2 = Vector2.Distance(this.xOwner.xTransform.v2Pos, this.xPlayerLockedOnto.xTransform.v2Pos); if (fDistance2 > fMaxRange2) { Vector2 v2Dir2 = Utility.Normalize(this.xPlayerLockedOnto.xTransform.v2Pos - this.xOwner.xTransform.v2Pos); this.v2JumpTarget = this.v2JumpOrigin + v2Dir2 * fMaxRange2; return; } this.v2JumpTarget = this.xPlayerLockedOnto.xTransform.v2Pos; return; } else if (xIns.xEvent.afAlterableValues[1] == 1f) { if (this.enCurrentAction == LivingPuzzleBlockAI.Action.SuperJumpTraveling) { this.enCurrentAction = LivingPuzzleBlockAI.Action.SuperJumpWaitForAttack; this.iCounter = 0; return; } } else if (xIns.xEvent.afAlterableValues[1] == 2f) { Program.game.xCamera.SetShake(50); this.xOwner.xCollisionComponent.ActivateGroup(CollisionComponent.ColliderGroup.All); this.CreateShockwaves(ISpellInstance.iIDPool); } } }