コード例 #1
0
    void InteractWithPerson()
    {
        if (CurrentlyPickedUpObject != null && CurrentFloor.Person != null)
        {
            if (CurrentlyPickedUpObject.CanBeUsedOn(CurrentFloor.Person))
            {
                CurrentFloor.Person.UseObjectOn(CurrentlyPickedUpObject);
                CurrentFloor.Deactivate();

                RemoveObjectOfHand();

                TimeLeft += TIME_REWARD;
                Score++;
                AmountOfMatchesLeft--;

                Sounds.PlaySound(ESoundType.Interact);

                if (AmountOfMatchesLeft < MaxAmountOfMatches * MORE_BUILDINGS_TRESHOLD)
                {
                    AmountOfMatchesLeft = 0;
                    MaxAmountOfMatches  = 0;

                    GenerateNewBuildings(amountOfBuildingsToCreate, amountOfBuildingsToCreate);
                    if (amountOfBuildingsToCreate < 8)
                    {
                        amountOfBuildingsToCreate *= 2;
                    }

                    MoreBuildingsIndicator.gameObject.SetActive(true);
                    moreBuildingsIndicatorShown = true;
                    moreBuildingsIndicatorTimer = MORE_BUILDINGS_TIME;
                }

                if (TutorialProgress == ETutorialProgress.Interact)
                {
                    UpdateTutorialState(ETutorialProgress.Timer);
                }
            }
            else
            {
                Sounds.PlaySound(ESoundType.FailInteract);
            }
        }
    }