/// <summary>
    /// 设置前景对象的速度
    /// </summary>
    /// <param name="luaState"></param>
    /// <returns></returns>
    public static int SetBgSpriteObjectVelocity(ILuaState luaState)
    {
        BgSpriteObject spObj    = luaState.ToUserData(-3) as BgSpriteObject;
        float          velocity = (float)luaState.ToNumber(-2);
        float          angle    = (float)luaState.ToNumber(-1);

        luaState.Pop(3);
        spObj.SetVelocity(velocity, angle);
        return(0);
    }
Пример #2
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);
 }