private void UpdateCurrentAttack() { _currentAttack = _currentAttackPattern[_attackIndex]; if (_currentAttack == null) { for (var i = 0; i < 1; i++) { Debug.Log($"My name is {name} and my Number {i} Attack is Null. I can't fight without it. " + $"Please assign me in the editor and STOP BREAKING MY PREFAB. It's a very hard life to live. Thank you." + $"Also, my serialization is broken, so I can't be loaded from a different scene. So, maybe take the spaces out of my folder name." + $"Again, thank you. I love to battle!"); } } _attackState = _currentAttack.StartingState; _agent.speed = _currentAttack.ChaseSpeed; _agent.angularSpeed = _currentAttack.ChaseAngularSpeed; _agent.acceleration = _currentAttack.ChaseAcceleration; if (_attackState == RoombaAttackState.Chasing) { SetToChase(); } else if (_attackState == RoombaAttackState.WindingUp) { SetToWindingUp(); } else if (_attackState == RoombaAttackState.Attacking) { SetToAttack(); } else if (_attackState == RoombaAttackState.WindingDown) { SetToWindDown(); } }
private void SetToWindDown() { if (_currentAttack.Type == RoombaAttackType.Spin) { Spinning.SetActive(false); } _attackState = RoombaAttackState.WindingDown; _timeTilNextState = _currentAttack.WindDownTime; }
private void SetToAttack() { if (_currentAttack.Type == RoombaAttackType.Charge) { DashTrail.emitting = true; } _attackState = RoombaAttackState.Attacking; _timeTilNextState = _currentAttack.AttackDuration; }
private void SetToChase() { Melee.IsDeadly = false; _body.isKinematic = true; _agent.enabled = true; _body.isKinematic = true; _attackState = RoombaAttackState.Chasing; _timeTilNextState = _currentAttack.ChasingTime; }
private void SetToWindingUp() { if (_currentAttack.Type == RoombaAttackType.Spin) { Spinning.SetActive(true); } _agent.enabled = false; _body.isKinematic = false; _attackState = RoombaAttackState.WindingUp; _timeTilNextState = _currentAttack.WindUpTime; }