protected void Reset()
    {
        map                       = FindObjectOfType <MapGene>();
        rb                        = GetComponent <Rigidbody>();
        rb.constraints            = RigidbodyConstraints.FreezePositionY | RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ;
        rb.collisionDetectionMode = CollisionDetectionMode.Continuous;
        rb.useGravity             = false;
        rb.isKinematic            = true;
        GetComponent <SphereCollider>().radius = 0.4f;
        rendy = GetComponent <MeshRenderer>();

        Vector3 normCoords = GetNormalizedCoords(rb.position);

        tile     = map.tileMap[Mathf.FloorToInt(normCoords.z), Mathf.FloorToInt(normCoords.x)];
        nextTile = tile;
        hAxis    = "P" + playerNum + "Horizontal";
        vAxis    = "P" + playerNum + "Vertical";
        if (!(this is Pacman))
        {
            ReachTile();
        }
    }
Ejemplo n.º 2
0
    public override void OnInspectorGUI()
    {
        MapGene ob = (MapGene)target;

        GUILayout.BeginHorizontal();
        for (int i = 0; i < ob.numMaps; i++)
        {
            if (GUILayout.Button("Generate\nMap " + (i + 1)))
            {
                ob.ParseMapString(i + 1);
            }
            if (i % 2 == 1)
            {
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal();
            }
        }
        GUILayout.EndHorizontal();
        //var style = new GUIStyle(GUI.skin.button);
        //style.normal.textColor = Color.red;

        DrawDefaultInspector();
    }