49 lines
1.2 KiB
TypeScript
49 lines
1.2 KiB
TypeScript
|
|
/*
|
||
|
|
* @Author: WoNiu
|
||
|
|
* @Date: 2024-03-29 14:04:56
|
||
|
|
* @LastEditTime: 2024-03-29 14:14:48
|
||
|
|
* @LastEditors: WoNiu
|
||
|
|
* @Description: 玩家角色控制
|
||
|
|
*/
|
||
|
|
import { _decorator, Component, Node } from "cc";
|
||
|
|
import { GamerRoleNode } from "../Gamer/GamerRoleNode";
|
||
|
|
import { GamerRoleType } from "../Gamer/GamerRoleType";
|
||
|
|
const { ccclass, property } = _decorator;
|
||
|
|
|
||
|
|
@ccclass("GameRoleController")
|
||
|
|
/**
|
||
|
|
* @description: 玩家角色控制
|
||
|
|
*/
|
||
|
|
export class GameRoleController extends Component {
|
||
|
|
/** 玩家 1 角色 */
|
||
|
|
oneRole: GamerRoleNode;
|
||
|
|
/** 玩家 2 角色 */
|
||
|
|
twoRole: GamerRoleNode;
|
||
|
|
/** 玩家 3 角色 */
|
||
|
|
threeRole: GamerRoleNode;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @description: 初始化角色
|
||
|
|
* @param oneRoleType : 玩家 1
|
||
|
|
* @param twoRoleType : 玩家 2
|
||
|
|
* @param threeRoleType : 玩家 3
|
||
|
|
*/
|
||
|
|
initRole(
|
||
|
|
oneRoleType: GamerRoleType,
|
||
|
|
twoRoleType: GamerRoleType,
|
||
|
|
threeRoleType: GamerRoleType
|
||
|
|
) {
|
||
|
|
this.oneRole = new GamerRoleNode(oneRoleType);
|
||
|
|
this.twoRole = new GamerRoleNode(twoRoleType);
|
||
|
|
this.threeRole = new GamerRoleNode(threeRoleType);
|
||
|
|
|
||
|
|
this.node.addChild(this.oneRole);
|
||
|
|
this.node.addChild(this.twoRole);
|
||
|
|
this.node.addChild(this.threeRole);
|
||
|
|
}
|
||
|
|
|
||
|
|
start() {}
|
||
|
|
|
||
|
|
update(deltaTime: number) {}
|
||
|
|
}
|