forked from ForNeVeR/O21
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEntityId.fs
More file actions
37 lines (32 loc) · 965 Bytes
/
EntityId.fs
File metadata and controls
37 lines (32 loc) · 965 Bytes
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
// SPDX-FileCopyrightText: 2024 O21 contributors <https://github.com/ForNeVeR/O21>
//
// SPDX-License-Identifier: MIT
namespace O21.Game.Engine
module EntityId =
[<Struct>]
type FishId = FishId of uint64
with
static member empty = FishId 0UL
static member prefix = 1us
[<Struct>]
type BombId = BombId of uint64
with
static member empty = BombId 0UL
static member prefix = 2us
[<Struct>]
type BonusId = BonusId of uint64
with
static member empty = BonusId 0UL
static member prefix = 3us
let (|IsFishId|_|) (id: objnull) =
match id with
| :? FishId as fishId -> Some fishId
| _ -> None
let (|IsBombId|_|) (id: objnull) =
match id with
| :? BombId as bombId -> Some bombId
| _ -> None
let (|IsBonusId|_|) (id: objnull) =
match id with
| :? BonusId as bonusId -> Some bonusId
| _ -> None