medic charge level circle

This commit is contained in:
Robin Appelman 2025-06-28 19:38:31 +02:00
commit 225f008b63

View file

@ -1,4 +1,4 @@
import {Class, PlayerState, SpyState, Team, WorldBoundaries} from "../Data/Parser"; import {Class, MedicState, PlayerState, SpyState, Team, WorldBoundaries} from "../Data/Parser";
export interface PlayerProp { export interface PlayerProp {
player: PlayerState; player: PlayerState;
@ -52,7 +52,16 @@ export function Player(props: PlayerProp) {
const transform = () => `translate(${scaledX()} ${scaledY()}) scale(${1 / props.scale})`; const transform = () => `translate(${scaledX()} ${scaledY()}) scale(${1 / props.scale})`;
const rotate = () => `rotate(${270 - props.player.angle})`; const rotate = () => `rotate(${270 - props.player.angle})`;
const filter = () => props.player.ubered ? ((props.player.team === Team.Red) ? 'url(#sofGlowRed)' : 'url(#sofGlowBlue)') : ''; const filter = () => props.player.ubered ? ((props.player.team === Team.Red) ? 'url(#sofGlowRed)' : 'url(#sofGlowBlue)') : '';
const circleStrokeStyle = () => props.player.playerClass === Class.Spy ? `${(props.player.class_data as SpyState).cloak} 100` : "none"; const circleStrokeStyle = () => {
switch (props.player.playerClass) {
case Class.Medic:
return `${(props.player.class_data as MedicState).charge} 100`
case Class.Spy:
return `${(props.player.class_data as SpyState).cloak} 100`
default:
return "none";
}
}
const teamHatch = () => (props.player.team === Team.Red) ? `url(#diagonalHatchRed)` : `url(#diagonalHatchBlue)` const teamHatch = () => (props.player.team === Team.Red) ? `url(#diagonalHatchRed)` : `url(#diagonalHatchBlue)`
const fill = () => props.player.cloaked ? teamHatch() : teamColor(); const fill = () => props.player.cloaked ? teamHatch() : teamColor();