using System.Collections.Generic;
using System.Linq;
using Cirno.Scripts.Resources;
using Cirno.Scripts.Resources.Loot;
using Godot;
using Godot.Collections;

namespace Cirno.Scripts.Components.FSM.Enemy;

public partial class EnemyStorageModule : Node2D, IFSMStorage
{
    [Export]
    public EnemyFSMProxy Root { get; private set; }

    public Node2D RootAsNode => Root;
    
    public EnemyResource EnemyData => Root.EnemyResource;
    
    public Vector2 HomePosition { get; set; }
    
    public  Vector2 MovementDirection { get; set; }
    public Vector2 FacingDirection { get; set; }
    
    public Vector2 AimingDirection { get; set; }
    public Vector2 KnockbackVelocity { get; set; } = Vector2.Zero;

    public float MovementSpeed => Root.EnemyResource.MovementSpeed;

    public IEnumerable<LootDrop> LootDrops => Root.OverrideLoot ? Root.ExtraLoot : Root.EnemyResource.LootDrops.Concat(Root.ExtraLoot);

    public AiState AiState { get; set; }

}