예제 #1
0
    public void CreateDebugMesh()
    {
        if (Debugger.debug)
        {
            GameObject wrapper = new GameObject("Box Wrapper");
            GameObject t;
            for (int i = 0; i < 3; i++)
            {
                t = GameObject.CreatePrimitive(PrimitiveType.Cube);
                t.transform.parent        = wrapper.transform;
                t.name                    = "Cube " + (i + 1);
                t.transform.localPosition = Vector3.zero;
                t.transform.localRotation = Quaternion.Euler(0, i * 60, 0);
                t.transform.localScale    = new Vector3(2 * Mathf.Cos(Mathf.Deg2Rad * 30) * MyHexMetric.outerRadius, MyHexMetric.heightScaling, 2 * Mathf.Sin(Mathf.Deg2Rad * 30) * MyHexMetric.outerRadius);
            }
            wrapper.transform.parent        = this.transform;
            wrapper.transform.localPosition = Vector3.zero;

            HexCollider hC = this.gameObject.AddComponent <HexCollider>();
            hC.enabled    = false;
            hC.height     = 0.2f;
            hC.edgeRadius = MyHexMetric.outerRadius;
            hC.enabled    = true;
        }
    }
예제 #2
0
 private void Awake()
 {
     hC = this.gameObject.AddComponent <HexCollider>();
 }