Esempio n. 1
0
    /// <summary>
    /// 设置直线激光的长度
    /// <para>laser</para>
    /// <para>int laserLen 激光的长度</para>
    /// </summary>
    /// <param name="luaState"></param>
    /// <returns></returns>
    public static int SetLinearLaserLength(ILuaState luaState)
    {
        EnemyLinearLaser laser = luaState.ToUserData(-2) as EnemyLinearLaser;
        int laserLen           = luaState.ToInteger(-1);

        laser.SetLength(laserLen);
        return(0);
    }
Esempio n. 2
0
    /// <summary>
    /// 创建可发射的直线激光
    /// <para>texture 暂时指向于etama9的激光贴图</para>
    /// <para>laserLen 激光长度</para>
    /// <para>posX</para>
    /// <para>posY</para>
    /// </summary>
    /// <param name="luaState"></param>
    /// <returns></returns>
    public static int CreateLinearLaser(ILuaState luaState)
    {
        string id       = luaState.ToString(-4);
        int    laserLen = luaState.ToInteger(-3);
        float  posX     = (float)luaState.ToNumber(-2);
        float  posY     = (float)luaState.ToNumber(-1);

        luaState.Pop(4);
        EnemyLinearLaser laser = ObjectsPool.GetInstance().CreateBullet(BulletType.Enemy_LinearLaser) as EnemyLinearLaser;

        laser.SetStyleById(id);
        laser.SetLength(laserLen);
        laser.SetPosition(posX, posY);
        luaState.PushLightUserData(laser);
        return(1);
    }