コード例 #1
0
    public static void RoundLocalscaleOfObjs()
    {
        GameObject go = Selection.activeGameObject;

        Transform[] gos = go.GetComponentsInChildren <Transform>();
        for (int i = 0; i < gos.Length; i++)
        {
            KMTools.RoundLocalScale(gos[i].gameObject);
        }
    }
コード例 #2
0
    public static void RoundLocal()
    {
        GameObject go = Selection.activeGameObject;

        Transform[] gos = go.GetComponentsInChildren <Transform>();
        //Debug.Log(gos.Length);
        for (int i = 0; i < gos.Length; i++)
        {
            KMTools.RoundToDecByObj(gos[i].gameObject);
        }
    }
コード例 #3
0
    public static void RoundPosAndRot()
    {
        GameObject go = Selection.activeGameObject;

        if (go != null)
        {
            KMTools.RoundToDecByObj(go);
        }
        else
        {
            Debug.Log("you need select one object");
        }
    }
コード例 #4
0
    void CreateSlots()
    {
        if (prefab != null)
        {
            int    count = 0;
            Bounds b     = new Bounds();
            for (int y = 0; y < maxRows; ++y)
            {
                for (int x = 0; x < maxColumns; ++x)
                {
                    GameObject go = KMTools.AddGameObj(gameObject, prefab, true, false);
                    Transform  t  = go.transform;
                    t.localPosition = new Vector3(padding + (x + 0.5f) * width, -padding - (y + 0.5f) * height, 0f);
                    b.Encapsulate(new Vector3(padding * 2f + (x + 1) * width, -padding * 2f - (y + 1) * height, 0f));

                    if (++count >= maxItemCount)
                    {
                        return;
                    }
                }
            }
        }
    }