Add modular

This commit is contained in:
MrKBear 2022-02-16 21:58:28 +08:00
parent e188fc83bd
commit f999fc1268
2 changed files with 31 additions and 0 deletions

View File

@ -1,9 +1,23 @@
import { Individual } from "./Individual";
/**
*
*/
class Group {
/**
*
*/
public individuals: Individual[] = [];
/**
*
*/
public add(count: number = 1) {
for (let i = 0; i < count; i++) {
this.individuals.push(new Individual(this));
}
}
}
export default Group;

View File

@ -1,9 +1,26 @@
import type { Group } from "./Group";
/**
*
*/
class Individual {
/**
*
*/
public position: number[] = [0, 0, 0];
/**
*
*/
public group: Group;
/**
*
*/
public constructor(group: Group) {
this.group = group;
}
}
export default Individual;