Пример #1
0
        public void MortonOrder_0_0()
        {
            uint morton = ConverMortonOrder.GetMortonOrder(0, 0, 1, 1);

            Assert.AreEqual(0, morton);
            // Use the Assert class to test conditions
        }
Пример #2
0
    public void Register(SpriteRenderer target)
    {
        uint targetMorton = ConverMortonOrder.GetSpriteRendererMortonOrder(target, lengthX, lengthY);

        if (cells[targetMorton] == null)
        {
            Debug.Log("新規登録" + targetMorton);
            cells[targetMorton] = new MortonCell <SpriteRenderer>();
        }
        cells[targetMorton].Objects.Add(target);
    }
Пример #3
0
        public void MortonOrderSpriteRenderer_1_1()
        {
            float      lengthX = 250;
            float      lengthY = 125;
            GameObject obj     = new GameObject();

            obj.AddComponent <SpriteRenderer>();
            SpriteRenderer target = obj.GetComponent <SpriteRenderer>();

            target.transform.position = new Vector3(lengthX * 3, lengthY * 1, 0);
            target.size = new Vector2(100, 100);

            uint morton = ConverMortonOrder.GetSpriteRendererMortonOrder(target, lengthX, lengthY);

            Assert.AreEqual(22, morton);
        }
Пример #4
0
    public void Init()
    {
        float lengthX = 250;
        float lengthY = 125;

        GameObject obj = new GameObject();

        obj.AddComponent <SpriteRenderer>();
        SpriteRenderer target = obj.GetComponent <SpriteRenderer>();

        target.transform.position = new Vector3(lengthX * 3, lengthY * 1, 0);
        target.size = new Vector2(100, 100);


        // 登録
        uint targetMorton = ConverMortonOrder.GetSpriteRendererMortonOrder(target, lengthX, lengthY);

        if (cells[targetMorton] == null)
        {
            cells[targetMorton]         = new MortonCell <SpriteRenderer>();
            cells[targetMorton].Objects = new List <SpriteRenderer>();
        }
        cells[targetMorton].Objects.Add(target);
    }
Пример #5
0
        public void MortonOrderDeci_3_1()
        {
            uint morton = ConverMortonOrder.GetMortonOrder(32, 16, 10, 10);

            Assert.AreEqual(0b0111, morton);
        }
Пример #6
0
        public void MortonOrder_3_1()
        {
            uint morton = ConverMortonOrder.GetMortonOrder(3, 1, 1, 1);

            Assert.AreEqual(0b0111, morton);
        }