Skip to content

Instantly share code, notes, and snippets.

View orleonedev's full-sized avatar

Oreste Leone orleonedev

View GitHub Profile
@orleonedev
orleonedev / MyFonts.swift
Created April 21, 2022 18:19
Custom fonts for Swiftpm
import Foundation
import SwiftUI
public struct MyFonts {
public static func registerFonts() {
registerFont(bundle: Bundle.main , fontName: "YOUR-FONT-HERE", fontExtension: ".ttf") //change according to your ext.
}
fileprivate static func registerFont(bundle: Bundle, fontName: String, fontExtension: String) {
@orleonedev
orleonedev / WPHealthStates.swift
Created April 13, 2022 08:23
WillPower Health States in version 0.0.1(3)
class WPHealthState: GKState {
weak var game: WPGame?
var entity: WPEntity
init(withGame: WPGame, entity: WPEntity) {
self.game = withGame
self.entity = entity
super.init()
}
@orleonedev
orleonedev / WPHealthComponent.swift
Created April 13, 2022 08:15
Health State Machine declaration inside WPHealthComponent in version 0.0.1(3)
class WPHealthComponent: GKComponent {
var healthStateMachine: GKStateMachine
/*
.......
*/
init(/* .... */ ){
/*
......
*/
let defend = WPDefendState(withGame: game, entity: char)
@orleonedev
orleonedev / WPHealthComponent.swift
Created April 13, 2022 07:05
WillPower HealthComponent Version 0.0.1(3)
class WPHealthComponent: GKComponent {
var healthStateMachine: GKStateMachine
var game: WPGame
var char: WPEntity
var maxHearts: Int
var heartCounter: Int {
//......
}
init(withGame: WPGame, characterEnt: WPEntity, maxHearts: Int){