Пример #1
0
    private void checkAlienation()
    {
        if (MainMain.isAlienationPhase())
        {
            // we are alienated right now
            if (alienationStopWatch != null && alienationStopWatch.isRunning())
            {
                long myAlienationDuration = (int)((Convert.ToSingle(MainMain.secondsOfChildAlienation) * 1000.0f) + (1500.0f * randomFloat(0.0f, 1.0f)));
                if (alienationStopWatch.execeedesMilliseconds(myAlienationDuration))
                {
                    // we gonna end this
                    playSoundOfADyingChild();
                    destroyGameObjectsParent(body);
                    alienationStopWatch.stop();

                    isAlienated = true;
                    MainMain.noOfChildrenInAlienation--;
                }
                else
                {
                    // we stay in that phase
                    setGameObjectVisible((randomChanceOccurs(0.5f) ? true : false));
                }
            }
            // start my alienation
            else if (MainMain.noOfChildrenInAlienation < 2 && isAlienated == false)
            {
                MainMain.noOfChildrenInAlienation++;
                alienationStopWatch = new MyStopWatch();
                setGameObjectVisible(false);
            }
        }
    }
Пример #2
0
    void FixedUpdate()
    {
        long currentSecondsCounter = overallStopWatch.getElapsedSeconds();

        if (currentSecondsCounter < secondsBeforeSunMovement1)
        {
            return;
        }

        if (!longerSunShiningStopWatch.isRunning() || longerSunShiningStopWatch.execeedesMilliseconds(700))
        {
            longerSunShiningStopWatch.stop();

            float randomIntensity = getRandomIntensity(currentSecondsCounter);

            setColor(randomIntensity);
        }

        moveTheSun(currentSecondsCounter);
    }