@implementation demoScene{
-(void) initializeScene {
moon *_moon=[[moon alloc]init];
}
-(void) updateBeforeTransform: (CC3NodeUpdatingVisitor*) visitor {
deltaTime =deltaTime+visitor.deltaTime;
NSLog(@"delta time=%0.12f",deltaTime);
[_moon print:deltaTime/100000];
}
@end
这是我的问题。
我想在方法中从月球类创建一个对象,initializeScene
并且我想在方法中向该对象发送消息updateBeforeTransform
。
当我输入这样的代码时,我无法向_moon
对象发送消息并获得“未使用的变量”警告消息。
我知道该对象超出范围,但如果我需要从updateBeforeTransform
方法发送消息。方法在updateBeforeTransform
一秒钟内被调用 60 次。所以我不想在一秒钟内创建一个对象 60 次。
任何建议将不胜感激。