示例#1
0
    /// <summary>
    /// 敌机朝着某个方向做加速运动(带最大速度限制)
    /// <para>enemy</para>
    /// <para>velocity 速度</para>
    /// <para>速度的方向</para>
    /// <para>加速度</para>
    /// <para>速度最大值</para>
    /// </summary>
    /// <param name="luaState"></param>
    /// <returns></returns>
    public static int EnemyAccMoveTowardsWithLimitation(ILuaState luaState)
    {
        EnemyBase enemy       = luaState.ToUserData(-5) as EnemyBase;
        float     velocity    = (float)luaState.ToNumber(-4);
        float     angle       = (float)luaState.ToNumber(-3);
        float     acc         = (float)luaState.ToNumber(-2);
        float     maxVelocity = (float)luaState.ToNumber(-1);

        enemy.AccMoveTowardsWithLimitation(velocity, angle, acc, maxVelocity);
        return(0);
    }