/// <summary> /// 设置子弹的颜色与透明度 /// <para>bullet</para> /// <para>float rValue 0~255</para> /// <para>float gValue 0~255</para> /// <para>float bValue 0~255</para> /// </summary> /// <param name="luaState"></param> /// <returns></returns> public static int SetBulletColorWithAlpha(ILuaState luaState) { EnemyBulletBase bullet = luaState.ToUserData(-5) as EnemyBulletBase; float rValue = (float)luaState.ToNumber(-4); float gValue = (float)luaState.ToNumber(-3); float bValue = (float)luaState.ToNumber(-2); float alpha = (float)luaState.ToNumber(-1); luaState.Pop(5); bullet.SetColor(rValue, gValue, bValue, alpha); return(0); }
/// <summary> /// 设置子弹的颜色 /// <para>bullet</para> /// <para>float rValue 0~255</para> /// <para>float gValue 0~255</para> /// <para>float bValue 0~255</para> /// </summary> /// <param name="luaState"></param> /// <returns></returns> public static int SetBulletColor(ILuaState luaState) { int top = luaState.GetTop(); if (top == 4) { EnemyBulletBase bullet = luaState.ToUserData(-4) as EnemyBulletBase; float rValue = (float)luaState.ToNumber(-3); float gValue = (float)luaState.ToNumber(-2); float bValue = (float)luaState.ToNumber(-1); bullet.SetColor(rValue, gValue, bValue); } else { EnemyBulletBase bullet = luaState.ToUserData(-5) as EnemyBulletBase; float rValue = (float)luaState.ToNumber(-4); float gValue = (float)luaState.ToNumber(-3); float bValue = (float)luaState.ToNumber(-2); float alpha = (float)luaState.ToNumber(-1); bullet.SetColor(rValue, gValue, bValue, alpha); } return(0); }