Gameplay / HotWeaponLoadComponent
HotWeaponLoadComponent Class
Hot Weapon loading component is responsible for maintaining relevant parameters and logic of Hot Weapon loading action
Example usage: Create a script named "HotWeaponLoadSample1", place it in the object manager, open the script, enter the following code to save, run the game, the code is as follows:
@Component
export default class HotWeaponLoadSample1 extends Script {
protected onStart(): void {
// structure
const hotWeapon = this.gameObject as HotWeapon;
if (SystemUtil.isServer()) {
hotWeapon.loadEnabled = true;
hotWeapon.loadComponent.loadDuration = 1
hotWeapon.loadComponent.loadAfterFireEnabled = true;
hotWeapon.loadComponent.animationAssetId = "4172";
hotWeapon.loadComponent.onStartLoad.add(() => { console.log("loadComponent.onStartLoad Server") });
hotWeapon.loadComponent.onEndLoad.add(() => { console.log("loadComponent.onEndLoad Server") });
} else if (SystemUtil.isClient()) {
hotWeapon.loadComponent.onStartLoad.add(() => { console.log("loadComponent.onStartLoad Client") });
hotWeapon.loadComponent.onEndLoad.add(() => { console.log("loadComponent.onEndLoad Client") });
}
}
}
@Component
export default class HotWeaponLoadSample1 extends Script {
protected onStart(): void {
// structure
const hotWeapon = this.gameObject as HotWeapon;
if (SystemUtil.isServer()) {
hotWeapon.loadEnabled = true;
hotWeapon.loadComponent.loadDuration = 1
hotWeapon.loadComponent.loadAfterFireEnabled = true;
hotWeapon.loadComponent.animationAssetId = "4172";
hotWeapon.loadComponent.onStartLoad.add(() => { console.log("loadComponent.onStartLoad Server") });
hotWeapon.loadComponent.onEndLoad.add(() => { console.log("loadComponent.onEndLoad Server") });
} else if (SystemUtil.isClient()) {
hotWeapon.loadComponent.onStartLoad.add(() => { console.log("loadComponent.onStartLoad Client") });
hotWeapon.loadComponent.onEndLoad.add(() => { console.log("loadComponent.onEndLoad Client") });
}
}
}
Table of contents
Properties
onEndLoad: MulticastDelegateInterface <() => void > |
---|
Execute binding function at the end of server loading. |
onStartLoad: MulticastDelegateInterface <() => void > |
Execute binding function when the server starts loading. |
Accessors
animationAssetId(): string other |
---|
Get the bound animation GUID. |
loadAfterFireEnabled(): boolean other |
Obtain whether to activate the automatic loading function after firing. |
loadDuration(): number other |
Obtain loading time. |
Properties
onEndLoad
• onEndLoad: MulticastDelegateInterface
<() => void
>
Execute binding function at the end of server loading.
onStartLoad
• onStartLoad: MulticastDelegateInterface
<() => void
>
Execute binding function when the server starts loading.
Accessors
animationAssetId
• | • | ||||
---|---|---|---|---|---|
Get the bound animation GUID. Returns
| Set the animation GUID. Parameters
|
loadAfterFireEnabled
• | • | ||||
---|---|---|---|---|---|
Obtain whether to activate the automatic loading function after firing. Returns
| Set whether to enable the automatic loading function after firing. Precautions Only the server can be called before equipping the hot weapon, and both ends can be called after equipping Parameters
|
loadDuration
• | • | ||||
---|---|---|---|---|---|
Obtain loading time. Returns
| Set the loading time. Precautions Only the server can be called before equipping the hot weapon, and both ends can be called after equipping Parameters
|