Skip to content

Commit

Permalink
Add employee variations
Browse files Browse the repository at this point in the history
  • Loading branch information
Golen87 committed Aug 20, 2024
1 parent 7129777 commit 958133b
Show file tree
Hide file tree
Showing 3 changed files with 221 additions and 26 deletions.
198 changes: 185 additions & 13 deletions src/components/EmployeeData.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
/* Employee category data */

export enum EmployeeType {
Raccoon,
RaccoonGray,
RaccoonBrown,
RaccoonYellow,
RaccoonPurple,
RaccoonGreen,
Human, // Temporary. Replace with whatever.
}

Expand All @@ -16,13 +20,61 @@ export interface EmployeeTypeInterface {
export const EmployeeTypeData: {
[key in EmployeeType]: EmployeeTypeInterface;
} = {
[EmployeeType.Raccoon]: {
[EmployeeType.RaccoonGray]: {
spriteKeys: {
idle: "worker",
walk: ["workerWalk1", "workerWalk2", "workerWalk3", "workerWalk2"],
work: ["workerWork1", "workerWork2"],
},
},
[EmployeeType.RaccoonBrown]: {
spriteKeys: {
idle: "workerAlt1",
walk: [
"workerAlt1Walk1",
"workerAlt1Walk2",
"workerAlt1Walk3",
"workerAlt1Walk2",
],
work: ["workerAlt1Work1", "workerAlt1Work2"],
},
},
[EmployeeType.RaccoonYellow]: {
spriteKeys: {
idle: "workerAlt2",
walk: [
"workerAlt2Walk1",
"workerAlt2Walk2",
"workerAlt2Walk3",
"workerAlt2Walk2",
],
work: ["workerAlt2Work1", "workerAlt2Work2"],
},
},
[EmployeeType.RaccoonPurple]: {
spriteKeys: {
idle: "workerAlt3",
walk: [
"workerAlt3Walk1",
"workerAlt3Walk2",
"workerAlt3Walk3",
"workerAlt3Walk2",
],
work: ["workerAlt3Work1", "workerAlt3Work2"],
},
},
[EmployeeType.RaccoonGreen]: {
spriteKeys: {
idle: "workerAlt4",
walk: [
"workerAlt4Walk1",
"workerAlt4Walk2",
"workerAlt4Walk3",
"workerAlt4Walk2",
],
work: ["workerAlt4Work1", "workerAlt4Work2"],
},
},
[EmployeeType.Human]: {
spriteKeys: {
idle: "player",
Expand All @@ -35,9 +87,21 @@ export const EmployeeTypeData: {
/* Specific employee instance data */

export enum EmployeeId {
RaccoonTier1,
RaccoonTier2,
RaccoonTier3,
RaccoonGrayTier1,
RaccoonGrayTier2,
RaccoonGrayTier3,
RaccoonBrownTier1,
RaccoonBrownTier2,
RaccoonBrownTier3,
RaccoonYellowTier1,
RaccoonYellowTier2,
RaccoonYellowTier3,
RaccoonPurpleTier1,
RaccoonPurpleTier2,
RaccoonPurpleTier3,
RaccoonGreenTier1,
RaccoonGreenTier2,
RaccoonGreenTier3,
HumanTier1,
HumanTier2,
HumanTier3,
Expand All @@ -54,26 +118,134 @@ export interface EmployeeInterface {
}

export const EmployeeData: { [key in EmployeeId]: EmployeeInterface } = {
[EmployeeId.RaccoonTier1]: {
type: EmployeeType.Raccoon,
[EmployeeId.RaccoonGrayTier1]: {
type: EmployeeType.RaccoonGray,
name: "Raccoon employee",
tier: 1,
walkSpeed: 2,
workSpeed: 1,
cost: 300,
upgradeTo: EmployeeId.RaccoonGrayTier2,
},
[EmployeeId.RaccoonGrayTier2]: {
type: EmployeeType.RaccoonGray,
name: "Raccoon employee",
tier: 2,
walkSpeed: 3,
workSpeed: 2,
cost: 400,
upgradeTo: EmployeeId.RaccoonGrayTier3,
},
[EmployeeId.RaccoonGrayTier3]: {
type: EmployeeType.RaccoonGray,
name: "Raccoon employee",
tier: 3,
walkSpeed: 5,
workSpeed: 3,
cost: 800,
},

[EmployeeId.RaccoonBrownTier1]: {
type: EmployeeType.RaccoonBrown,
name: "Raccoon employee",
tier: 1,
walkSpeed: 2,
workSpeed: 1,
cost: 300,
upgradeTo: EmployeeId.RaccoonBrownTier2,
},
[EmployeeId.RaccoonBrownTier2]: {
type: EmployeeType.RaccoonBrown,
name: "Raccoon employee",
tier: 2,
walkSpeed: 3,
workSpeed: 2,
cost: 400,
upgradeTo: EmployeeId.RaccoonBrownTier3,
},
[EmployeeId.RaccoonBrownTier3]: {
type: EmployeeType.RaccoonBrown,
name: "Raccoon employee",
tier: 3,
walkSpeed: 5,
workSpeed: 3,
cost: 800,
},

[EmployeeId.RaccoonYellowTier1]: {
type: EmployeeType.RaccoonYellow,
name: "Raccoon employee",
tier: 1,
walkSpeed: 2,
workSpeed: 1,
cost: 300,
upgradeTo: EmployeeId.RaccoonYellowTier2,
},
[EmployeeId.RaccoonYellowTier2]: {
type: EmployeeType.RaccoonYellow,
name: "Raccoon employee",
tier: 2,
walkSpeed: 3,
workSpeed: 2,
cost: 400,
upgradeTo: EmployeeId.RaccoonYellowTier3,
},
[EmployeeId.RaccoonYellowTier3]: {
type: EmployeeType.RaccoonYellow,
name: "Raccoon employee",
tier: 3,
walkSpeed: 5,
workSpeed: 3,
cost: 800,
},

[EmployeeId.RaccoonPurpleTier1]: {
type: EmployeeType.RaccoonPurple,
name: "Raccoon employee",
tier: 1,
walkSpeed: 2,
workSpeed: 1,
cost: 300,
upgradeTo: EmployeeId.RaccoonPurpleTier2,
},
[EmployeeId.RaccoonPurpleTier2]: {
type: EmployeeType.RaccoonPurple,
name: "Raccoon employee",
tier: 2,
walkSpeed: 3,
workSpeed: 2,
cost: 400,
upgradeTo: EmployeeId.RaccoonPurpleTier3,
},
[EmployeeId.RaccoonPurpleTier3]: {
type: EmployeeType.RaccoonPurple,
name: "Raccoon employee",
tier: 3,
walkSpeed: 5,
workSpeed: 3,
cost: 800,
},

[EmployeeId.RaccoonGreenTier1]: {
type: EmployeeType.RaccoonGreen,
name: "Raccoon employee",
tier: 1,
walkSpeed: 2,
workSpeed: 1,
cost: 300,
upgradeTo: EmployeeId.RaccoonTier2,
upgradeTo: EmployeeId.RaccoonGreenTier2,
},
[EmployeeId.RaccoonTier2]: {
type: EmployeeType.Raccoon,
[EmployeeId.RaccoonGreenTier2]: {
type: EmployeeType.RaccoonGreen,
name: "Raccoon employee",
tier: 2,
walkSpeed: 3,
workSpeed: 2,
cost: 400,
upgradeTo: EmployeeId.RaccoonTier3,
upgradeTo: EmployeeId.RaccoonGreenTier3,
},
[EmployeeId.RaccoonTier3]: {
type: EmployeeType.Raccoon,
[EmployeeId.RaccoonGreenTier3]: {
type: EmployeeType.RaccoonGreen,
name: "Raccoon employee",
tier: 3,
walkSpeed: 5,
Expand Down
31 changes: 21 additions & 10 deletions src/components/Levels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,23 @@ export enum BlockType {
ScalePolish = 4,
GoldBath = 5,
CashRegister = 6,
Employee = 9,

EmployeeGray = 11,
EmployeeBrown = 12,
EmployeeYellow = 13,
EmployeePurple = 14,
EmployeeGreen = 15,
}

const _ = BlockType.Empty;
const X = BlockType.Wall;

const A = BlockType.EmployeeGray;
const B = BlockType.EmployeeBrown;
const C = BlockType.EmployeeYellow;
const D = BlockType.EmployeePurple;
const E = BlockType.EmployeeGreen;

export const LevelData: Level[] = [
{
id: LevelId.Level1,
Expand All @@ -37,10 +48,10 @@ export const LevelData: Level[] = [
cellSize: 190,
grid: [
[X, X, X, X, X, X, X, X],
[X, 2, _, 9, 0, 9, 4, X],
[X, 2, _, A, B, C, 4, X],
[X, 2, _, 3, 3, _, 4, X],
[_, _, _, _, _, _, _, X],
[X, _, 5, 5, _, 6, 9, _],
[X, _, 5, 5, _, 6, _, _],
[X, X, X, X, X, X, X, X],
],
upgradeCost: 1000,
Expand All @@ -53,11 +64,11 @@ export const LevelData: Level[] = [
cellSize: 150,
grid: [
[X, X, X, X, X, X, X, X, X],
[X, 2, _, _, _, _, 9, _, X],
[X, 2, _, A, B, C, D, _, X],
[X, 2, _, 3, 3, 3, _, 4, X],
[X, 2, _, _, 9, _, _, 4, X],
[X, 2, _, _, _, _, _, 4, X],
[_, _, _, 5, 5, 5, _, _, X],
[X, _, 9, _, _, _, 6, 9, _],
[X, _, _, _, _, _, 6, _, _],
[X, X, X, X, X, X, X, X, X],
],
upgradeCost: 2000,
Expand All @@ -70,12 +81,12 @@ export const LevelData: Level[] = [
cellSize: 138,
grid: [
[X, X, X, X, X, X, X, X, X, X],
[X, 2, _, _, _, _, _, 9, _, X],
[X, 2, _, A, B, C, D, E, _, X],
[X, 2, _, 3, _, 3, _, 4, 4, X],
[X, 2, _, 3, 9, 3, _, _, _, X],
[X, 2, _, _, _, _, 9, 4, 4, X],
[X, 2, _, 3, _, 3, _, _, _, X],
[X, 2, _, _, _, _, _, 4, 4, X],
[_, _, _, 5, 5, 5, _, _, _, X],
[X, _, 9, _, _, _, _, 6, 9, _],
[X, _, _, _, _, _, _, 6, _, _],
[X, X, X, X, X, X, X, X, X, X],
],
},
Expand Down
18 changes: 15 additions & 3 deletions src/scenes/GameScene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class GameScene extends BaseScene {
StationId.ScalePolishTier1,
StationId.CashRegister,
],
employees: [EmployeeId.RaccoonTier1],
employees: [EmployeeId.RaccoonGrayTier1],
};

// Background
Expand Down Expand Up @@ -315,8 +315,20 @@ export class GameScene extends BaseScene {
case BlockType.CashRegister:
this.addStation(gridX, gridY, StationId.CashRegister);
break;
case BlockType.Employee:
this.addEmployee(gridX, gridY, EmployeeId.RaccoonTier1);
case BlockType.EmployeeGray:
this.addEmployee(gridX, gridY, EmployeeId.RaccoonGrayTier1);
break;
case BlockType.EmployeeBrown:
this.addEmployee(gridX, gridY, EmployeeId.RaccoonBrownTier1);
break;
case BlockType.EmployeeYellow:
this.addEmployee(gridX, gridY, EmployeeId.RaccoonYellowTier1);
break;
case BlockType.EmployeePurple:
this.addEmployee(gridX, gridY, EmployeeId.RaccoonPurpleTier1);
break;
case BlockType.EmployeeGreen:
this.addEmployee(gridX, gridY, EmployeeId.RaccoonGreenTier1);
break;
}
}
Expand Down

0 comments on commit 958133b

Please sign in to comment.