summaryrefslogtreecommitdiff
path: root/src/engine/actors/Ship.h
blob: 312140aea438ee7cfc797888fb23076697f45e41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#pragma once

#include <libultraship.h>
#include <libultra/gbi.h>
#include "engine/CoreMath.h"
#include "engine/registry/RegisterContent.h"
#include "engine/Actor.h"

class AShip : public AActor {
public:

    enum Skin : int16_t {
        GHOSTSHIP,
        SHIP2,
        SHIP3,
    };

    explicit AShip(const SpawnParams& params);
    virtual ~AShip() = default;

    // This is simply a helper function to keep Spawning code clean
    static AShip* Spawn(FVector pos, IRotator rot, FVector scale, int16_t skin) {
        SpawnParams params = {
            .Name = "hm:ship",
            .Type = skin, // which ship model to use
            .Location = pos,
            .Rotation = rot,
            .Scale = scale,
        };
        return dynamic_cast<AShip*>(AddActorToWorld<AShip>(params));
    }

    AShip::Skin SpawnSkin = Skin::GHOSTSHIP;

    virtual void SetSpawnParams(SpawnParams& params) override;
    virtual void Tick() override;
    virtual void BeginPlay() override;
    virtual bool IsMod() override;
    virtual void DrawEditorProperties() override;
private:
    Gfx* _skin;
};