public static bool Set(object o, TValue key, ref TValue value)
    {
        EnemySimpleBullet bullet = (EnemySimpleBullet)o;

        if (key.TtIsString())
        {
            switch (key.SValue())
            {
                #region 基础变量
            case "x":
            {
                Vector2 pos = bullet.GetPosition();
                pos.x = (float)value.NValue;
                bullet.SetPosition(pos);
                return(true);
            }

            case "y":
            {
                Vector2 pos = bullet.GetPosition();
                pos.y = (float)value.NValue;
                bullet.SetPosition(pos);
                return(true);
            }

            case "rot":
            {
                bullet.SetRotation((float)value.NValue);
                return(true);
            }

                #endregion
                #region 运动相关变量
            case "v":
            {
                bullet.Velocity = (float)value.NValue;
                return(true);
            }

            case "vx":
            {
                bullet.Vx = (float)value.NValue;
                return(true);
            }

            case "vy":
            {
                bullet.Vy = (float)value.NValue;
                return(true);
            }

            case "vAngle":
            {
                bullet.VAngle = (float)value.NValue;
                return(true);
            }

            case "maxV":
            {
                bullet.MaxVelocity = (float)value.NValue;
                return(true);
            }

            case "acce":
            {
                bullet.Acce = (float)value.NValue;
                return(true);
            }

            case "accAngle":
            {
                bullet.AccAngle = (float)value.NValue;
                return(true);
            }

                #endregion
                #region 子弹类专属变量
            case "orderInLayer":
            {
                bullet.SetOrderInLayer((int)value.NValue);
                return(true);
            }

            case "checkCollision":
            {
                bullet.SetDetectCollision(value.BValue());
                return(true);
            }

            case "navi":
            {
                bullet.SetRotatedByVelocity(value.BValue());
                return(true);
            }

            case "checkBorder":
            {
                bullet.SetCheckOutOfBorder(value.BValue());
                return(true);
            }

            case "alpha":
            {
                bullet.SetAlpha((float)value.NValue);
                return(true);
            }

            case "omega":
            {
                bullet.SetSelfRotation((float)value.NValue);
                return(true);
            }

            case "scale":
            {
                bullet.SetScale((float)value.NValue);
                return(true);
            }

            case "scaleX":
            {
                bullet.SetBulletPara(BulletParaType.ScaleX, (float)value.NValue);
                return(true);
            }

            case "scaleY":
            {
                bullet.SetBulletPara(BulletParaType.ScaleY, (float)value.NValue);
                return(true);
            }
                #endregion
            }
        }
        value.SetSValue(string.Format("SetField of userData fail!Invalid key {0} for type {1}", key, typeof(EnemySimpleBullet).Name));
        return(false);
    }
Пример #2
0
    public static bool Set(object o, TValue key, ref TValue value)
    {
        EnemyCurveLaser bullet = (EnemyCurveLaser)o;

        if (key.TtIsString())
        {
            switch (key.SValue())
            {
                #region 基础变量
            case "x":
            {
                Vector2 pos = bullet.GetPosition();
                pos.x = (float)value.NValue;
                bullet.SetPosition(pos);
                return(true);
            }

            case "y":
            {
                Vector2 pos = bullet.GetPosition();
                pos.y = (float)value.NValue;
                bullet.SetPosition(pos);
                return(true);
            }

            case "rot":
            {
                bullet.SetRotation((float)value.NValue);
                return(true);
            }

                #endregion
                #region 运动相关变量
            case "v":
            {
                bullet.velocity = (float)value.NValue;
                return(true);
            }

            case "vx":
            {
                bullet.vx = (float)value.NValue;
                return(true);
            }

            case "vy":
            {
                bullet.vy = (float)value.NValue;
                return(true);
            }

            case "vAngle":
            {
                bullet.vAngle = (float)value.NValue;
                return(true);
            }

            case "maxV":
            {
                bullet.maxVelocity = (float)value.NValue;
                return(true);
            }

            case "acce":
            {
                bullet.acce = (float)value.NValue;
                return(true);
            }

            case "accAngle":
            {
                bullet.accAngle = (float)value.NValue;
                return(true);
            }

                #endregion
                #region 子弹类专属变量
            case "orderInLayer":
            {
                bullet.SetOrderInLayer((int)value.NValue);
                return(true);
            }

            case "checkCollision":
            {
                bullet.SetDetectCollision(value.BValue());
                return(true);
            }

            case "checkBorder":
            {
                bullet.SetCheckOutOfBorder(value.BValue());
                return(true);
            }
                #endregion
            }
        }
        value.SetSValue(string.Format("SetField of userData fail!Invalid key {0} for type {1}", key, typeof(EnemyCurveLaser).Name));
        return(false);
    }
Пример #3
0
    public static bool Set(object o, TValue key, ref TValue value)
    {
        NormalEnemy enemy = (NormalEnemy)o;

        if (key.TtIsString())
        {
            switch (key.SValue())
            {
                #region 基础变量
            case "x":
            {
                Vector2 pos = enemy.GetPosition();
                pos.x = (float)value.NValue;
                enemy.SetPosition(pos);
                return(true);
            }

            case "y":
            {
                Vector2 pos = enemy.GetPosition();
                pos.y = (float)value.NValue;
                enemy.SetPosition(pos);
                return(true);
            }

            case "rot":
            {
                enemy.SetRotation((float)value.NValue);
                return(true);
            }

                #endregion
                #region 运动相关变量
            case "v":
            {
                enemy.velocity = (float)value.NValue;
                return(true);
            }

            case "vx":
            {
                enemy.vx = (float)value.NValue;
                return(true);
            }

            case "vy":
            {
                enemy.vy = (float)value.NValue;
                return(true);
            }

            case "vAngle":
            {
                enemy.vAngle = (float)value.NValue;
                return(true);
            }

            case "maxV":
            {
                enemy.maxVelocity = (float)value.NValue;
                return(true);
            }

            case "acce":
            {
                enemy.acce = (float)value.NValue;
                return(true);
            }

            case "accAngle":
            {
                enemy.accAngle = (float)value.NValue;
                return(true);
            }

                #endregion
            case "checkBorder":
            {
                enemy.SetCheckOutOfBorder(value.BValue());
                return(true);
            }
            }
        }
        value.SetSValue(string.Format("SetField of userData fail!Invalid key {0} for type {1}", key, typeof(NormalEnemy).Name));
        return(false);
    }