Ejemplo n.º 1
0
 private bool handleClickOnQuit(InputManager.InputHit hit)
 {
     this.jarvis.stop();
     this.information.GetComponent <TextMesh> ().text = "Waiting jarvis to stop";
     while (this.jarvis.isThinking())
     {
     }
     this.theming [0].SetColor("_Color", Color.black);
     this.theming [0].SetFloat("_Metallic", 0.21f);
     this.theming [0].SetFloat("_Glossiness", 0.46f);
     this.theming [0].SetColor("_EmissionColor", new Color(0.1f, 0.1f, 0.1f));
     this.theming [1].SetColor("_Color", Color.white);
     this.theming [1].SetFloat("_Metallic", 0.21f);
     this.theming [1].SetFloat("_Glossiness", 0.46f);
     this.theming [1].SetColor("_EmissionColor", new Color(0.1f, 0.1f, 0.1f));
     this.theming [2].SetFloat("_Metallic", 1);
     this.theming [2].SetFloat("_Glossiness", 0.5f);
     this.theming [2].SetColor("_EmissionColor", new Color(0.2f, 0.2f, 0.2f));
     this.theming [3].SetColor("_Color", new Color(0, 0.506f, 0.667f));
     this.theming [3].SetFloat("_Metallic", 1);
     this.theming [3].SetFloat("_Glossiness", 0);
     this.theming [3].SetColor("_EmissionColor", new Color(0.2f, 0.2f, 0.2f));
     this.information.GetComponent <TextMesh> ().text = "Successfully Quit";
     Application.Quit();
     return(true);
 }
Ejemplo n.º 2
0
    private bool handleMoveOnBoard(InputManager.InputHit hit)
    {
        int clicked_index = this.positionToIndex(hit.position);

        this.highlight(false, this.selected_index != clicked_index, false, this.indexToPosition(clicked_index));
        return(true);
    }
Ejemplo n.º 3
0
    private bool handleClickOnNewGame(InputManager.InputHit hit)
    {
        this.board_manager.get("default").reset();
        this.jarvis.stop();
        this.is_ai_thinking = false;
        this.information.GetComponent <TextMesh>().text    = "";
        this.information_ai.GetComponent <TextMesh>().text = "";
        for (int i = 0; i < 64; i++)
        {
            this.board_indexes [i] = -1;
        }
        this.selector.SetActive(false);
        this.selected_index = -1;
        Vector3 position;

        for (int i = 0; i < 16; i++)
        {
            this.board_indexes [i] = i;
            position = this.indexToPosition(i);
            this.board_objects [i].GetComponent <PieceController> ().show();
            this.board_objects [i].GetComponent <PieceController> ().setPieceType(Piece.Type.PAWN);
            this.board_objects [i].GetComponent <PieceController> ().move(position.x, position.z);
            this.board_indexes [64 - 1 - i] = 16 + i;
            position = this.indexToPosition(64 - 1 - i);
            this.board_objects [16 + i].GetComponent <PieceController> ().show();
            this.board_objects [16 + i].GetComponent <PieceController> ().setPieceType(Piece.Type.PAWN);
            this.board_objects [16 + i].GetComponent <PieceController> ().move(position.x, position.z);
        }
        return(true);
    }
Ejemplo n.º 4
0
 private bool handleClickOnOptionTheme(InputManager.InputHit hit)
 {
     if (this.option_theming % 3 == 0)           // gold
     {
         this.theming [0].SetColor("_Color", new Color(0.694f, 0, 0, 1));
         this.theming [0].SetFloat("_Metallic", 1);
         this.theming [0].SetFloat("_Glossiness", 0.52f);
         this.theming [0].SetColor("_EmissionColor", Color.black);
         this.theming [1].SetColor("_Color", new Color(1, 0.914f, 0.522f));
         this.theming [1].SetFloat("_Metallic", 1);
         this.theming [1].SetFloat("_Glossiness", 0.43f);
         this.theming [1].SetColor("_EmissionColor", new Color(0.1f, 0.1f, 0.1f));
         this.theming [2].SetFloat("_Metallic", 1);
         this.theming [2].SetFloat("_Glossiness", 0.5f);
         this.theming [2].SetColor("_EmissionColor", new Color(1, 1, 1));
         this.theming [3].SetColor("_Color", new Color(0.8f, 0.8f, 0.8f));
         this.theming [3].SetFloat("_Metallic", 1);
         this.theming [3].SetFloat("_Glossiness", 0);
         this.theming [3].SetColor("_EmissionColor", new Color(0, 0, 0));
     }
     else if (this.option_theming % 3 == 1)             // wood
     {
         this.theming [0].SetColor("_Color", new Color(0.380f, 0.435f, 0.471f));
         this.theming [0].SetFloat("_Metallic", 1);
         this.theming [0].SetFloat("_Glossiness", 0);
         this.theming [0].SetColor("_EmissionColor", new Color(0, 0, 0));
         this.theming [1].SetColor("_Color", new Color(0.871f, 0.722f, 0.529f));
         this.theming [1].SetFloat("_Metallic", 0.59f);
         this.theming [1].SetFloat("_Glossiness", 0);
         this.theming [1].SetColor("_EmissionColor", new Color(0.1f, 0.1f, 0.1f));
         this.theming [2].SetFloat("_Metallic", 1);
         this.theming [2].SetFloat("_Glossiness", 0);
         this.theming [2].SetColor("_EmissionColor", new Color(0, 0, 0));
         this.theming [3].SetColor("_Color", new Color(0, 0.506f, 0.667f));
         this.theming [3].SetFloat("_Metallic", 1);
         this.theming [3].SetFloat("_Glossiness", 0);
         this.theming [3].SetColor("_EmissionColor", new Color(0, 0, 0));
     }
     else if (this.option_theming % 3 == 2)             // normal 194 255 170
     {
         this.theming [0].SetColor("_Color", Color.black);
         this.theming [0].SetFloat("_Metallic", 0.21f);
         this.theming [0].SetFloat("_Glossiness", 0.46f);
         this.theming [0].SetColor("_EmissionColor", new Color(0.1f, 0.1f, 0.1f));
         this.theming [1].SetColor("_Color", Color.white);
         this.theming [1].SetFloat("_Metallic", 0.21f);
         this.theming [1].SetFloat("_Glossiness", 0.46f);
         this.theming [1].SetColor("_EmissionColor", new Color(0.1f, 0.1f, 0.1f));
         this.theming [2].SetFloat("_Metallic", 1);
         this.theming [2].SetFloat("_Glossiness", 0.5f);
         this.theming [2].SetColor("_EmissionColor", new Color(0.2f, 0.2f, 0.2f));
         this.theming [3].SetColor("_Color", new Color(0, 0.506f, 0.667f));
         this.theming [3].SetFloat("_Metallic", 1);
         this.theming [3].SetFloat("_Glossiness", 0);
         this.theming [3].SetColor("_EmissionColor", new Color(0.2f, 0.2f, 0.2f));
     }
     this.option_theming += 1;
     return(true);
 }
Ejemplo n.º 5
0
 private bool handleMouseMove()
 {
     InputManager.InputHit hit = this.input_manager.getHit();
     if (this.move_to_handler.ContainsKey(hit.gameobject.tag))
     {
         return(this.move_to_handler [hit.gameobject.tag].Invoke(hit));
     }
     return(false);
 }
Ejemplo n.º 6
0
    private bool handleClickOnBoard(InputManager.InputHit hit)
    {
        int clicked_index = this.positionToIndex(hit.position);

        if (this.selected_index == clicked_index)
        {
            this.selected_index = -1;
            this.selector.SetActive(false);
        }
        else if (!this.is_ai_thinking && this.moving_index == -1 && !this.is_rotating && this.selected_index != -1)
        {
            if (this.referee.move(selected_index, clicked_index))
            {
                this.information.GetComponent <TextMesh>().text = "";
                Board     default_board = this.board_manager.get("default");
                GameEvent game_event;
                while ((game_event = default_board.doLastEvent(selected_index, clicked_index)) != GameEvent.NONE)
                {
                    this.event_to_handler [game_event].Invoke(selected_index, clicked_index);
                }
                default_board.swapCurrentTeam();
            }
            this.selected_index = -1;
            this.selector.SetActive(false);
        }
        else if (this.board_indexes [clicked_index] != -1)
        {
            this.selected_index = clicked_index;
            this.selector.SetActive(true);
            this.selector.transform.position = this.indexToPosition(clicked_index);
            return(true);
        }
        else
        {
            return(false);
        }
        return(true);
    }
Ejemplo n.º 7
0
 private bool handleMoveOnPromote(InputManager.InputHit hit)
 {
     this.highlight(false, false, true, hit.gameobject.transform.position);
     return(true);
 }
Ejemplo n.º 8
0
 private bool handleClickOnPromoteQueen(InputManager.InputHit hit)
 {
     return(true);
 }
Ejemplo n.º 9
0
 private bool handleClickOnOptionRotate(InputManager.InputHit hit)
 {
     this.option_rotation = !this.option_rotation;
     hit.gameobject.transform.parent.GetComponentInChildren <TextMesh>().text = (this.option_rotation) ? "Deactivate rotation" : "Activate rotation";
     return(true);
 }
Ejemplo n.º 10
0
 private bool handleClickOnOptions(InputManager.InputHit hit)
 {
     this.options_menu.SetActive(!this.options_menu.activeSelf);
     return(true);
 }