private void HandleReturnFromAttack() { var targetPosition = _playerInitialPosition; var playerPosition = _playerTransform.position; var direction = targetPosition - playerPosition; var velocity = playerPosition + (direction.normalized * (Time.deltaTime * _speed)); _playerTransform.position = velocity; _speed += 0.3f; if (direction.magnitude <= 0.1f) { _playerTransform.position = _playerInitialPosition; _speed = 1; _isAttacking = false; _isReturningFromAttack = false; _currentBattleAction = null; _isPerforming = false; HandleAttackCompleted(); } }
public void Reflect(int damage) { _currentBattleAction = new BattleAction() { Type = ActionType.Reflect, Value = damage }; _isPerforming = true; }
public void Shield(int damage) { _currentBattleAction = new BattleAction() { Type = ActionType.Shield, Value = damage }; _isPerforming = true; }
public void Attack(Monster target, int damage) { _currentBattleAction = new BattleAction() { Type = ActionType.Attack, Value = damage }; _isPerforming = true; _isAttacking = true; _isReturningFromAttack = false; _target = target; }
private void HandleReflect() { _audioSource.PlayOneShot(ReflectClips[Random.Range(0, ReflectClips.Count)]); ReflectTooltip.Activate(_currentBattleAction.Value); _reflectValue = _currentBattleAction.Value; _currentBattleAction = null; _isPerforming = false; Battle.IsCompletingTurn = false; Battle.ChangeTurn(); }
private void HandleShield() { _audioSource.PlayOneShot(ShieldClips[Random.Range(0, ShieldClips.Count)]); ShieldTooltip.Activate(_currentBattleAction.Value); _shieldValue = _currentBattleAction.Value; _currentBattleAction = null; _isPerforming = false; Battle.IsCompletingTurn = false; Battle.ChangeTurn(); }
private void Awake() { _monsterTransform = transform; _monsterInitialPosition = _monsterTransform.position; _currentBattleAction = new BattleAction(); _audioSource = gameObject.GetComponentNoAlloc <AudioSource>(); _spriteRenderer = gameObject.GetComponentInChildren <SpriteRenderer>(); _isPerforming = false; GenerateMonsterType(); }