Esempio n. 1
0
    KMSelectable.OnInteractHandler GetInteractHandler(KMSelectable selectable, ButtonInfo buttonInfo)
    {
        return(delegate()
        {
            Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.ButtonPress, transform);
            selectable.AddInteractionPunch(0.5f);
            string Direction = selectable.ToString().Split(' ').First();

            if (!Solved)
            {
                if (buttonInfo.resetButton)
                {
                    CurX = StartX;
                    CurY = StartY;
                    UpdatePosition();
                    ButtonRotation(CurX, CurY);
                    DebugLog("Resetted, now at ({0}, {1})", RotX, RotY);
                    //DebugLog("Resetted, now at ({0}, {1})", CurX + 1, CurY + 1);
                }
                else if (CurrentP.Contains(buttonInfo.invalidDirection))
                {
                    ButtonRotation(CurX, CurY);
                    DebugLog("There is a wall to the {0} at ({1}, {2}). Strike.", Direction, RotX, RotY);
                    //DebugLog("There is a wall at {1}, {2}, and it doesn't match the manual. SOMEone should fix this.", CurX + 1, CurY + 1);
                    BombModule.HandleStrike();
                }
                else
                {
                    UpdatePosition(Direction, buttonInfo.xOffset, buttonInfo.yOffset, true);
                }
            }

            return false;
        });
    }
Esempio n. 2
0
    void SubmitBUTT()
    {
        string player = BUTTon.ToString();
        char   c      = player.ElementAt(7);
        var    num    = int.Parse(c.ToString());

        messagessubmit = new List <string>();
        foreach (var msg in resource.GetMessages()[num - 1].Where(x => x != null))
        {
            if (resource.GetMessages()[num - 1].Where(x => x != null).Count() == 0)
            {
                continue;
            }
            messagessubmit.Add(msg.ToLower().Trim());
        }
        bool ismatched = false;

        for (int i = 0; i < messagessolved.Count; i++)
        {
            if (messagessolved.Count() > messagessubmit.Count())
            {
                break;
            }
            if (messagessubmit.Contains(messagessolved[i].ToLower().Trim()))
            {
                ismatched = true;
            }
        }
        if (messagessubmit.Count() == 0 && messagessolved.Count() == 0)
        {
            ismatched = true;
        }
        if (!ismatched)
        {
            messagessolved.Clear();
            GetComponent <KMBombModule>().HandleStrike();
            return;
        }
        if (night == 4)
        {
            night = 4;
        }
        else
        {
            night = int.Parse(Moon_number.text);
            night++;
            Moon_number.text = night.ToString();
        }
        if (night == 4)
        {
            GetComponent <KMBombModule>().HandlePass();
        }
        foreach (KMSelectable player1 in Players)
        {
            player1.gameObject.SetActive(true);
        }
        Arrows_to_Players.SetActive(true);
        Moon_button.gameObject.SetActive(true);

        RolesDisplay.GetComponent <Renderer>().enabled = false;
        RolesDisplay.Highlight.gameObject.SetActive(false);
        Role_mesh.GetComponent <Renderer>().enabled = false;

        RoleArrows[0].GetComponent <Renderer>().enabled = false;
        RoleArrows[0].Highlight.gameObject.SetActive(false);

        RoleArrows[1].GetComponent <Renderer>().enabled = false;
        RoleArrows[1].Highlight.gameObject.SetActive(false);

        MessagesDisplay.GetComponent <Renderer>().enabled = false;
        MessagesDisplay.Highlight.gameObject.SetActive(false);
        Message_mesh.GetComponent <Renderer>().enabled = false;

        MessageArrows[0].GetComponent <Renderer>().enabled = false;
        MessageArrows[0].Highlight.gameObject.SetActive(false);

        MessageArrows[1].GetComponent <Renderer>().enabled = false;
        MessageArrows[1].Highlight.gameObject.SetActive(false);

        Display.GetComponent <Renderer>().enabled = false;
        Display.Highlight.gameObject.SetActive(false);

        Submit.GetComponent <Renderer>().enabled = false;
        Submit.Highlight.gameObject.SetActive(false);
        Submit_mesh.GetComponent <Renderer>().enabled = false;

        Return.GetComponent <Renderer>().enabled = false;
        Return.Highlight.gameObject.SetActive(false);
        Return_mesh.GetComponent <Renderer>().enabled = false;

        MessageRoleArrows[0].Highlight.gameObject.SetActive(false);
        MessageRoleArrows[0].GetComponent <Renderer>().enabled = false;

        MessageRoleArrows[1].Highlight.gameObject.SetActive(false);
        MessageRoleArrows[1].GetComponent <Renderer>().enabled = false;

        MessageRoleDisplay.Highlight.gameObject.SetActive(false);
        MessageRoleDisplay.GetComponent <Renderer>().enabled = false;
        MessageRole_mesh.GetComponent <Renderer>().enabled   = false;
        StartCoroutine(UpdateHighlights());
        index  = 0;
        index1 = 0;
        foreach (var message in messagessubmit)
        {
            if (message == "You are dead!")
            {
                Players_Letter[num - 1].color = new Color32(255, 255, 0, 255);
            }
        }
        if (isPlayersub[num - 1] == true)
        {
            return;
        }
        else
        {
            Players_Letter[num - 1].color = new Color32(0, 255, 0, 255);
            isPlayersub[num - 1]          = true;
        }
        messagessolved.Clear();
    }
Esempio n. 3
0
    void Submission(KMSelectable button)
    {
        this.BUTTon = button;
        string player = button.ToString();
        char   c      = player.ElementAt(7);
        var    num    = int.Parse(c.ToString());

        if (isPlayersub[num - 1] == true)
        {
            return;
        }
        foreach (KMSelectable player1 in Players)
        {
            player1.gameObject.SetActive(false);
        }
        Arrows_to_Players.SetActive(false);
        Moon_button.gameObject.SetActive(false);

        RolesDisplay.GetComponent <Renderer>().enabled = true;
        RolesDisplay.Highlight.gameObject.SetActive(true);
        Role_mesh.GetComponent <Renderer>().enabled = true;

        RoleArrows[0].GetComponent <Renderer>().enabled = true;
        RoleArrows[0].Highlight.gameObject.SetActive(true);

        RoleArrows[1].GetComponent <Renderer>().enabled = true;
        RoleArrows[1].Highlight.gameObject.SetActive(true);

        MessagesDisplay.GetComponent <Renderer>().enabled = true;
        MessagesDisplay.Highlight.gameObject.SetActive(true);
        Message_mesh.GetComponent <Renderer>().enabled = true;

        MessageArrows[0].GetComponent <Renderer>().enabled = true;
        MessageArrows[0].Highlight.gameObject.SetActive(true);

        MessageArrows[1].GetComponent <Renderer>().enabled = true;
        MessageArrows[1].Highlight.gameObject.SetActive(true);

        Submit.GetComponent <Renderer>().enabled = true;
        Submit.Highlight.gameObject.SetActive(true);
        Submit_mesh.GetComponent <Renderer>().enabled = true;

        Return.GetComponent <Renderer>().enabled = true;
        Return.Highlight.gameObject.SetActive(true);
        Return_mesh.GetComponent <Renderer>().enabled = true;

        desiredrole = resource.Players_roles[num - 1];

        RolesDisplay.OnInteract += delegate()
        {
            selectedrole = Role_mesh.text;
            if (desiredrole == selectedrole)
            {
                switch (selectedrole)
                {
                case "Sheriff":
                    isSheriff = true;
                    break;

                case "Consigliere":
                    isConsig = true;
                    break;

                case "Tracker":
                    isTracker = true;
                    break;

                case "Escort":
                    isEscort = true;
                    break;

                case "Consort":
                    isConsort = true;
                    break;

                default:
                    break;
                }
                isRoleSelected = true;
            }
            else
            {
                GetComponent <KMBombModule>().HandleStrike();
            }
            return(false);
        };
    }