基础技能完善

This commit is contained in:
2024-08-22 09:04:26 +08:00
parent ee7f1c322b
commit ceee58079d
39 changed files with 1999 additions and 63 deletions

View File

@@ -0,0 +1,29 @@
import { _decorator, color, Component, Material, Node, Sprite } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('FlashSprite')
export class FlashSprite extends Component {
@property(Material)
hitFlashMaterial: Material;
orginalFlashMaterial: Material;
sprite: Sprite;
start() {
this.sprite = this.node.getComponent(Sprite);
this.orginalFlashMaterial = this.sprite.getRenderMaterial(0);
}
update(deltaTime: number) {
}
public clickFlash() {
this.sprite.setSharedMaterial(this.hitFlashMaterial, 0);
this.scheduleOnce(() => {
this.sprite.setSharedMaterial(this.orginalFlashMaterial, 0);
}, 0.1);
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "df953176-a9fa-4f3e-865e-7956fccc4c52",
"files": [],
"subMetas": {},
"userData": {}
}