Пример #1
0
    private void SlotBoxReleaseHandler(GameObject slotBoxObj, GameObject puckObj)
    {
        SlotBoxScript slotBox = slotBoxObj.GetComponentInChildren <SlotBoxScript>();

        if (slotBox != null)
        {
            PrizeComponent prize = slotBox.currentPrize;

            if (prize != null && prize.otherType == Constants.BUG_PRIZE_TYPE && remainingBugs > 0)
            {
                //objectiveText.text = string.Format(objectiveString, --remainingBugs, bugsGoal);

                if (--remainingBugs <= 0)
                {
                    //objectiveText.text = completedString;
                    if (EventList.AddRotatingText != null)
                    {
                        EventList.AddRotatingText(titleString, completedString);
                    }
                    string missionId = Constants.GetMissionId(missionName);
                    if (missionId == null)
                    {
                        Debug.LogError("Could not retrieve mission Id for mission name: " + missionName);
                        return;
                    }

                    if (EventList.MissionCompleted != null)
                    {
                        EventList.MissionCompleted(missionId);
                    }
                }
                else if (EventList.AddRotatingText != null)
                {
                    EventList.AddRotatingText(titleString, string.Format(objectiveString, remainingBugs, bugsGoal));
                }
            }
        }
    }
Пример #2
0
    private void SlotBoxReleaseHandler(GameObject slotBox, GameObject puck)
    {
        SlotBoxScript slotScript = slotBox.GetComponentInChildren <SlotBoxScript>();

        if (slotScript == null)
        {
            Debug.LogError("UserManager - cannot process prize component because slot box did not have a slot box script.");
            return;
        }

        LaunchData launch = puck.GetComponent <LaunchData>();

        if (launch == null)
        {
            Debug.LogError("UserManager - cannot process prize component because the puck did not have an attached launch data object.");
            return;
        }

        PrizeComponent prize  = slotScript.GetPrize();
        string         userId = launch.Player.Id;

        ApplyPrize(prize, userId);
    }