Beispiel #1
0
    void check_character_select()
    {
        if (Input.GetMouseButtonUp(0))
        {
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

            Debug.DrawLine(ray.origin, ray.direction * 50000000, Color.red);

            RaycastHit hitinfo;
            int        layer_mask = LayerMask.GetMask("Character");
            //Debug.Log("layer_mask = " + layer_mask);

            if (Physics.Raycast(ray, out hitinfo, Mathf.Infinity, layer_mask))
            {
                if (selected_character != hitinfo.transform.parent.parent.parent.gameObject)
                {
                    selected_character = hitinfo.transform.parent.parent.parent.gameObject;
                    move_tile_indicator.show_movable_tiles(selected_character.GetComponent <Character>());

                    log_box.AddEvent("Selected Character");
                }
            }
        }
    }