/// <summary> /// 设置前景对象的自旋速度 /// </summary> /// <param name="luaState"></param> /// <returns></returns> public static int SetBgSpriteObjectSelfRotateAngle(ILuaState luaState) { BgSpriteObject spObj = luaState.ToUserData(-4) as BgSpriteObject; float xAngle = (float)luaState.ToNumber(-3); float yAngle = (float)luaState.ToNumber(-2); float zAngle = (float)luaState.ToNumber(-2); luaState.Pop(4); spObj.SetSelfRotateAngle(new Vector3(xAngle, yAngle, zAngle)); return(0); }
public override void Update(int curFrame) { if (curFrame % 30 == 0) { BgSpriteObject spObj = CreateBgSpriteObject("Common/MapleLeaf1"); float posX = Random.Range(80, 150); float posY = Random.Range(200, 225); spObj.SetToPos(posX, posY); float scale = Random.Range(0.2f, 1); spObj.SetScale(new Vector3(scale, scale)); spObj.SetVelocity(Random.Range(1f, 3f), Random.Range(-150, -30)); spObj.SetSelfRotateAngle(new Vector3(0, 0, Random.Range(1f, 2f))); spObj.DoFade(Random.Range(90, 180), Random.Range(180, 300)); } if (_isCameraMoving) { MoveCamera(); } base.Update(curFrame); }