private void CheckClickOutcome()
    {
        if (currentClickCount >= 1.0f)
        {
            currentClickCount -= 1.0f;
            int newFollowers           = 1; // Can eventually do random, or increased based on items
            var newFollowerObject      = GameObject.Instantiate(Resources.Load("Prefabs/SocialMedia/Home/HomeFollowerText") as GameObject);
            var followerObjectPosition = newFollowerObject.transform.position;
            followerObjectPosition.x             = 0.0f;
            followerObjectPosition.y             = 2.5f;
            newFollowerObject.transform.position = followerObjectPosition;

            var newFollowerText = newFollowerObject.transform.Find("DGFollowerText").gameObject;
            newFollowerText.GetComponent <TextMesh>().text = "+" + newFollowers + " Follower";
            serializer.AddFollowers(newFollowers);
        }

        currentRandomEventCount = currentRandomEventCount * 1.2f;
        var randomEventRoll = Random.Range(0, 500);

        if (randomEventRoll < currentRandomEventCount)
        {
            eventController.CreateNewEvent();
            currentRandomEventCount = 1;
        }
    }
Esempio n. 2
0
    private void UserInputCheck()
    {
        // For testing only
        if (Input.GetKeyDown(KeyCode.M))
        {
            globalVars.AddCash(50.0f);
            serializer.AddFollowers(50);
        }

        if (Input.GetMouseButtonDown(0))
        {
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;
            if (Physics.Raycast(ray, out hit))
            {
                if (eventController && eventController.EventInPlay())
                {
                    eventController.CheckUserInput(hit.collider.name);
                }
                else if (messagesController && messagesController.PopupActive())
                {
                    CheckPageInput(hit.collider.name);
                }
                else if (postController && postController.PopupActive())
                {
                    CheckPageInput(hit.collider.name);
                }
                else
                {
                    switch (hit.collider.name)
                    {
                    case "HomePageButton":
                        soundController.PlayClickSound(1);
                        GenerateHomePage();
                        break;

                    case "ProfilePageButton":
                        soundController.PlayClickSound(1);
                        GenerateProfilePage();
                        break;

                    case "PostPageButton":
                        soundController.PlayClickSound(1);
                        GeneratePostPage();
                        break;

                    case "MessagesPageButton":
                        soundController.PlayClickSound(1);
                        GenerateMessagesPage();
                        break;

                    default:
                        CheckPageInput(hit.collider.name);
                        break;
                    }
                }
            }
        }
    }
Esempio n. 3
0
    private void ChooseRandomEvent()
    {
        // Get random from events/3 because each is a 3-phase event
        var eventMultiChoiceRange = eventScreens.Count / 3;
        var eventOneOffRange      = eventOneOffScreens.Count;
        var index = Random.Range(0, eventMultiChoiceRange + eventOneOffRange);

        if (index < eventMultiChoiceRange)
        {
            // Ensures you start on a "first" phase of event
            eventIndex        = index;
            eventScreensIndex = index * 3;
            eventScreen.GetComponent <SpriteRenderer>().sprite = eventScreens[eventScreensIndex];
        }
        else
        {
            var oneOffIndex = index - eventMultiChoiceRange;
            eventScreen.GetComponent <SpriteRenderer>().sprite = eventOneOffScreens[oneOffIndex];

            var value = eventOneOffResultValues[oneOffIndex];
            switch (eventOneOffResultTypes[oneOffIndex])
            {
            case "Followers":
                serializer.AddFollowers(value);
                break;

            case "Money":
                globalVars.AddCash(value);
                break;
            }

            DisableYesAndNoButtons();
            var okayButton = eventContainer.transform.Find("OneOffOkayButton");
            if (okayButton)
            {
                okayButton.GetComponent <Collider>().enabled = true;
            }
            var outcomeText = eventContainer.transform.Find("OneOffOutcomeText");
            if (outcomeText)
            {
                GenerateOutcomeText(outcomeText, value, eventOneOffResultTypes[oneOffIndex]);
            }
        }
    }
Esempio n. 4
0
    public void CheckUserInput()
    {
        if (Input.GetMouseButtonDown(0))
        {
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;
            if (Physics.Raycast(ray, out hit))
            {
                if (popupObject)
                {
                    if (hit.collider.name == "OkayButton")
                    {
                        GameObject.Destroy(popupObject);
                    }
                }
                else
                {
                    switch (hit.collider.name)
                    {
                    case "FollowersForHireButton":
                        if (globalVars.TotalCash >= 10.0f)
                        {
                            globalVars.AddCash(-10.0f);
                            dgSerializer.AddFollowers(10);
                            UpdateText();
                            GeneratePopup("FollowersForHire");
                        }
                        break;

                    case "DoubleClickButton":
                        if (globalVars.TotalCash >= 30.0f)
                        {
                            globalVars.AddCash(-30.0f);
                            dgSerializer.SetDoubleClickAbility();
                            UpdateText();
                            GeneratePopup("DoubleClick");
                        }
                        break;

                    case "MessengerBotButton":
                        if (globalVars.TotalCash >= 40.0f)
                        {
                            globalVars.AddCash(-40.0f);
                            dgSerializer.SetMessageBotAbility();
                            GeneratePopup("MessengerBot");
                        }
                        break;
                    }
                }
            }
        }
    }