为什么这么写花不会有动画效果?

gwtn

1 回复20 浏览

来自课程:Cocos版植物大战僵尸第一季(cocos creator3.8版本)

老师您好,有个问题想请教下。

在addPlant这个函数中,有写道:

this.currentPlant = plant;

那为什么用

plant.getComponent(Plant).transToEnable(); 会有将状态设置为激活,

而使用

this.currentPlant.getComponent(Plant).transToEnable(); 会报错?

全部回复(1)

  • 老师_Jokey 1 楼

    应该是没问题的,老师这里写这两种,动画都是正常的

发表回复

登录后可以回复