
/**
 * 玩家部件
 */

import {getTextureByName, getfactor} from "../utils";
export class PlayerPart extends engine.Sprite implements IPlayerPart {
	constructor(name) {
		super();

		this.changeRes(name)
	}

	changeRes(name) {
		this.name = name;
        this.texture = getTextureByName('body_normal_'+name)
	};
        

	setSkin(name) {
		this.texture = getTextureByName('body_' + name + '_' + this.name);
	}

	// update(x, y, rotation, sleeping) {
	// 	this.x = x;
	// 	this.y = y;
	// 	this.rotation = rotation;
	// 	//this.alpha = sleeping ? 0.5 : 1;
    // }
    localUpdate(x, y, rotation, sleeping){
		this.x = x;
		this.y = y;
		this.rotation = rotation;
		//this.alpha = sleeping ? 0.5 : 1;
    }
	get fSize() {
		return {width: this.fWidth, height: this.fHeight}
	}

	get fWidth() {
        return this.width / getfactor();
	}

	get fHeight() {
        return this.height / getfactor();
	}

	reset() {

	}
}
