/// <summary> /// 延时之后前景对象逐渐消失的效果 /// </summary> /// <param name="luaState"></param> /// <returns></returns> public static int BgSpriteObjectDoFade(ILuaState luaState) { BgSpriteObject spObj = luaState.ToUserData(-3) as BgSpriteObject; int fadeDuration = luaState.ToInteger(-2); int fadeDelay = luaState.ToInteger(-1); luaState.Pop(3); spObj.DoFade(fadeDuration, fadeDelay); 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); }