server/src/game/environment.object.ts

49 lines
1.0 KiB
TypeScript

import {
ObjectPropertyExclude,
ObjectProperty,
} from 'src/types/property.decorator';
import { SerializedObject } from 'src/types/serialized';
import { Color, Vector3 } from 'three';
import { GameObject } from './game-object';
export class Environment extends GameObject {
public objectType = 'Environment';
@ObjectPropertyExclude()
public name = 'Environment';
public virtual = true;
@ObjectPropertyExclude()
public override visible!: boolean;
@ObjectProperty()
sunColor!: Color;
@ObjectProperty()
sunPosition!: Vector3;
@ObjectProperty()
sunStrength!: number;
@ObjectProperty()
ambientColor!: Color;
@ObjectProperty()
ambientStrength!: number;
@ObjectProperty()
clearColor!: Color;
override serialize() {
return super.serialize() as SerializedEnvironment;
}
}
export interface SerializedEnvironment extends SerializedObject {
sunColor: Color;
sunPosition: Vector3;
sunStrength: number;
ambientColor: Color;
ambientStrength: number;
clearColor: Color;
}