-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Renderer and attempt to generalise UnitGenerator #18
Changes from 1 commit
d0c78ad
fddde37
1edd041
60b6601
43aea1c
8e5798a
c018312
310ad10
d9f8693
36e28a9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,8 +37,23 @@ class GameWorld { | |
selectionNode.unitNodeDidSpawn(location) | ||
} | ||
|
||
private func setUpSelectionNode() { | ||
func handleContact(between idA: UUID, and idB: UUID) { | ||
guard let entityA = entityManager.entity(with: idA), let entityB = entityManager.entity(with: idB), | ||
let event = entityA.collide(with: entityB) else { | ||
return | ||
} | ||
|
||
eventManager.add(event) | ||
} | ||
|
||
func handleSeparation(between idA: UUID, and idB: UUID) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a need to implement this? since we don't have a separation logic if the units come into contact with each other but perhaps for future powerups this can be a good one. |
||
guard let entityA = entityManager.entity(with: idA), let entityB = entityManager.entity(with: idB) else { | ||
return | ||
} | ||
// TODO: Handle any separation logic here. | ||
} | ||
|
||
private func setUpSelectionNode() { | ||
selectionNode.delegate = self | ||
scene?.addChild(selectionNode) | ||
// Position unit selection node on the left side of the screen | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// | ||
// Collidable.swift | ||
// TowerForge | ||
// | ||
// Created by Zheng Ze on 22/3/24. | ||
// | ||
|
||
import Foundation | ||
|
||
protocol Collidable { | ||
func collide(with other: Collidable) -> TFEvent? | ||
func collide(with damageComponent: DamageComponent) -> TFEvent? | ||
func collide(with healthComponent: HealthComponent) -> TFEvent? | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,6 @@ import Foundation | |
protocol SceneUpdateDelegate: AnyObject { | ||
func update(deltaTime: TimeInterval) | ||
func touch(at location: CGPoint) | ||
func contactBegin(between nodeA: TFAnimatableNode, and nodeB: TFAnimatableNode) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above, perhaps changing TFAnimatableNode to TFSpriteNode? |
||
func contactEnd(between nodeA: TFAnimatableNode, and nodeB: TFAnimatableNode) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking if we couldjust generalise it to the TFSpriteNode instead of AnimatableNode? and also changing from
contactBegin
tocontactDidBegin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep sure ill change it in my next pr.