コード例 #1
0
ファイル: SongeUtil.cs プロジェクト: SongE1989/TradeGame
    public static void SetVec(ref Vector3 tar, float value, EnumVector dir)
    {
        float newValueX = dir == EnumVector.x ? value : tar.x;
        float newValueY = dir == EnumVector.y ? value : tar.y;
        float newValueZ = dir == EnumVector.z ? value : tar.z;

        tar.Set(newValueX, newValueY, newValueZ);
    }
コード例 #2
0
ファイル: SongeUtil.cs プロジェクト: SongE1989/TradeGame
    public static void SetLocalPos(this Transform tar, float value, EnumVector dir)
    {
        float newValueX = dir == EnumVector.x ? value : tar.localPosition.x;
        float newValueY = dir == EnumVector.y ? value : tar.localPosition.y;
        float newValueZ = dir == EnumVector.z ? value : tar.localPosition.z;

        tar.localPosition = new Vector3(newValueX, newValueY, newValueZ);
    }
コード例 #3
0
  public static void Main() {
    EnumVector ev = new EnumVector();

    check((int)ev.nums[0], 10);
    check((int)ev.nums[1], 20);
    check((int)ev.nums[2], 30);

    int expected = 10;
    foreach (EnumVector.numbers val in ev.nums) {
      check((int)val, expected);
      expected += 10;
    }
  }
コード例 #4
0
    public static void Main()
    {
        EnumVector ev = new EnumVector();

        check((int)ev.nums[0], 10);
        check((int)ev.nums[1], 20);
        check((int)ev.nums[2], 30);

        int expected = 10;

        foreach (EnumVector.numbers val in ev.nums)
        {
            check((int)val, expected);
            expected += 10;
        }
    }
コード例 #5
0
ファイル: SongeUtil.cs プロジェクト: SongE1989/TradeGame
 public static void SetLocalPos(this GameObject tar, float value, EnumVector dir)
 {
     SetLocalPos(tar.transform, value, dir);
 }