public void SetTempAnimation(Sprite[] sprites, float speed) { if (!sprites.Any()) return; _temp_anim_speed = 1 / 5.0f / Mathf.Abs(speed); if (_current_temp_animation != null) return; _current_temp_animation = sprites; _frame_index = 0; _current_time = 0; _sprite_renderer.sprite = _current_temp_animation[_frame_index]; }
public void SetBaseAnimation(Sprite[] sprites, float speed) { if (!sprites.Any()) return; if (sprites == RunSpritesBackhand || sprites == RunSpritesForehand) _base_anim_speed = 1 / 5.0f / Mathf.Abs(speed); else _base_anim_speed = 1 / 5.0f; if (_current_base_animation == sprites) return; _current_base_animation = sprites; _frame_index = 0; _current_time = 0; if (_current_temp_animation == null && _sprite_renderer != null && _current_base_animation != null) _sprite_renderer.sprite = _current_base_animation[_frame_index]; }