Skip to content

Commit

Permalink
migrate a 6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
nearnshaw committed Jun 1, 2019
1 parent 10fc646 commit 0987e18
Show file tree
Hide file tree
Showing 17 changed files with 145 additions and 126 deletions.
6 changes: 3 additions & 3 deletions bin/game.js

Large diffs are not rendered by default.

Binary file added models/walkers/BlockDog.glb
Binary file not shown.
28 changes: 14 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion scene.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
"0,0",
"0,1",
"1,0",
"1,1"
"1,1",
"0,2",
"1,2"

],
"base": "0,0"
},
Expand Down
24 changes: 12 additions & 12 deletions src/customer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ const customerWrongDishMessages = [
export class CustomerData {
dish: IngredientType
message: string
speechBubble: Entity
speechBubble: IEntity
receivedDish: boolean = true // to force the 1st initialization
plate: CustomerPlate
shape: GLTFShape
timeBeforeLeaving: number
timeBeforeEntering: number
waitingTimer: number
customerEntity: Entity
progressBar: Entity
customerEntity: IEntity
progressBar: IEntity
}

@Component('customerPlate')
Expand All @@ -109,7 +109,7 @@ let scoreTextShape: TextShape = new TextShape(
)
scoreTextShape.textWrapping = false
scoreTextShape.color = Color3.Green()
scoreTextShape.fontSize = 150
scoreTextShape.fontSize = 2
scoreTextShape.width = 10
scoreTextEntity.addComponent(scoreTextShape)
scoreTextEntity.addComponent(
Expand All @@ -126,7 +126,7 @@ let missesTextShape: TextShape = new TextShape(
)
missesTextShape.textWrapping = false
missesTextShape.color = Color3.Red()
missesTextShape.fontSize = 150
missesTextShape.fontSize = 2
missesTextShape.width = 10
missesTextEntity.addComponent(missesTextShape)
missesTextEntity.addComponent(
Expand Down Expand Up @@ -169,7 +169,7 @@ export class CustomersSystem implements ISystem {
let progressBarParent = customerData.progressBar.getParent()
engine.removeEntity(customerData.progressBar)
customerData.progressBar = null
engine.removeEntity(progressBarParent, true)
engine.removeEntity(progressBarParent)

continue
}
Expand All @@ -181,7 +181,7 @@ export class CustomersSystem implements ISystem {
if (customerData.waitingTimer <= 0) {
if (customerData.receivedDish) {
if (customerData.speechBubble) {
engine.removeEntity(customerData.speechBubble, true)
engine.removeEntity(customerData.speechBubble)
}

customerData.shape.visible = false
Expand All @@ -197,7 +197,7 @@ export class CustomersSystem implements ISystem {
}
}

initializeCustomer(customer: Entity, customerData: CustomerData) {
initializeCustomer(customer: IEntity, customerData: CustomerData) {
customerData.receivedDish = false
customerData.timeBeforeEntering = Scalar.RandomRange(3, 6)
customerData.timeBeforeLeaving = Scalar.RandomRange(3, 4)
Expand Down Expand Up @@ -258,11 +258,11 @@ function updateSpeechBubble(
customerData.message = newMessage

if (customerData.speechBubble) {
engine.removeEntity(customerData.speechBubble, true)
engine.removeEntity(customerData.speechBubble)
}

if (customerData.progressBar) {
engine.removeEntity(customerData.progressBar, true)
engine.removeEntity(customerData.progressBar)
}

customerData.speechBubble = createSpeechBubble(
Expand Down Expand Up @@ -292,7 +292,7 @@ export function createCustomer(position: Vector3, plate: CustomerPlate) {
)

// TODO: Add shape randomization
let shape = new GLTFShape('models/walkers/BlockDog.gltf')
let shape = new GLTFShape('models/walkers/BlockDog.glb')
customer.addComponent(shape)
customerData.shape = shape

Expand Down Expand Up @@ -382,7 +382,7 @@ export function deliverOrder(plate: CustomerPlate) {
}
}

const sittingAnimation = new AnimationClip('Sitting')
const sittingAnimation = new AnimationState('Sitting')
sittingAnimation.looping = false
// const eatingAnimation = new AnimationClip('Drinking', { loop: false })
sittingAnimation.play()
6 changes: 3 additions & 3 deletions src/customerProgressBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export class CustomerProgressBar {
movesUp: boolean = true
color: Material
speed: number = 1
parent: Entity
constructor(parent: Entity, speed: number = 1, movesUp: boolean = true) {
parent: IEntity
constructor(parent: IEntity, speed: number = 1, movesUp: boolean = true) {
this.parent = parent
this.speed = speed
this.movesUp = movesUp
Expand Down Expand Up @@ -66,7 +66,7 @@ export class CustProgressBarUpdate implements ISystem {
}
}

export function createCustProgressBar(parent: Entity, speed: number = 1) {
export function createCustProgressBar(parent: IEntity, speed: number = 1) {
let background = new Entity()
background.addComponent(new PlaneShape())
background.setParent(parent)
Expand Down
18 changes: 9 additions & 9 deletions src/cuttingBoard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const cutsNeeded: number = 5
export class CuttingBoard {
hasRoll: boolean = false
cuts: number = 0
rollChild: Entity
rollChild: IEntity
cutting: boolean = false
cutTime: number = 0.7
totalCutTime: number = 0.7
Expand Down Expand Up @@ -61,28 +61,28 @@ export class CutSystem implements ISystem {
const sushiPlateShape = new GLTFShape('models/PlateSushi.glb')
const trashShape = new GLTFShape('models/GarbageFood.glb')

export function AddSushi(DroppedObject: Entity, cuttingBoadrd: CuttingBoard) {
export function AddSushi(DroppedObject: IEntity, cuttingBoadrd: CuttingBoard) {
let grabbableObject = DroppedObject.getComponent(GrabableObjectComponent)
if (grabbableObject.type == IngredientType.SushiRoll) {
cuttingBoadrd.hasRoll = true
cuttingBoadrd.cuts = 0
cuttingBoadrd.rollChild = DroppedObject
cuttingBoadrd.rollChild.removeComponent(OnPointerDown)
cuttingBoadrd.rollChild.removeComponent(OnClick)
log('added roll')
} else if (grabbableObject.type == IngredientType.SlicedSushi) {
cuttingBoadrd.hasRoll = true
cuttingBoadrd.cuts = cutsNeeded
cuttingBoadrd.rollChild = DroppedObject
cuttingBoadrd.rollChild.removeComponent(OnPointerDown)
cuttingBoadrd.rollChild.removeComponent(OnClick)
log('roll is already cut')
}
DroppedObject.getComponent(Transform).rotation.setEuler(0, 90, 0)
//engine.removeEntity(DroppedObject)
}

export function ClickBoard(
GrabberEntity: Entity,
cutter: Entity,
GrabberEntity: IEntity,
cutter: IEntity,
objectGrabberSystem: ObjectGrabberSystem
) {
let cuttingBoadrd = cutter.getComponent(CuttingBoard)
Expand All @@ -107,7 +107,7 @@ export function ClickBoard(
)
trash.addComponent(new GrabableObjectComponent(IngredientType.Trash, true))
trash.addComponent(
new OnPointerDown(e => {
new OnClick(e => {
objectGrabberSystem.grabObject(trash)
})
)
Expand Down Expand Up @@ -135,7 +135,7 @@ export function ClickBoard(
new GrabableObjectComponent(IngredientType.SlicedSushi, true)
)
sushiPlate.addComponent(
new OnPointerDown(e => {
new OnClick(e => {
objectGrabberSystem.grabObject(sushiPlate)
})
)
Expand All @@ -149,7 +149,7 @@ export function ClickBoard(
}
}

export function cutRoll(cuttingBoard: Entity) {
export function cutRoll(cuttingBoard: IEntity) {
let cutter = cuttingBoard.getComponent(CuttingBoard)
cutter.cuts += 1
cutter.cutting = true
Expand Down
4 changes: 2 additions & 2 deletions src/finishedGameUI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ export class FinishedGameUI implements ISystem {
playerScore
)
textShapeComponent.textWrapping = true
textShapeComponent.fontSize = 50
textShapeComponent.hAlign = 'center'
textShapeComponent.fontSize = 5
textShapeComponent.hTextAlign = 'center'
textEntity.addComponent(textShapeComponent)

textEntity.addComponent(
Expand Down
Loading

0 comments on commit 0987e18

Please sign in to comment.