Пример #1
0
    public void GamePhase()
    {
        // Randomize race
        lastRace = Random.Range(0, 3);

        spaceShip.SetCurrentSprite(lastRace);



        // Set lastMeaning variable (that will be called by PhraseGenerator)
        var meanings = UtilitiesGen.GetEnumValues <Meaning>();

        lastMeaning = meanings[Random.Range(0, meanings.Length - 1)]; //only war and peace intention

        // Get symbols and generate symbols class
        SymbolsEvents.ActivatePanel(PhraseEvents.GetPhrase().symbols);

        // Activate slider
        SliderEvents.SliderActivation(true);

        // Move space ship
        StartCoroutine(spaceShip.MoveToPosition(timeToReachEarth));

        spaceShip.reset();
        spaceShip.earthObject.GetComponent <EarthEnergyHandler>().reset();

        // AUDIO
        if (lastRace == 0)
        {
            EventManager.Invoke(SoundManagerTopics.PlayEffect, AudioClipName.Cervelloni02);
        }
        else if (lastRace == 1)
        {
            EventManager.Invoke(SoundManagerTopics.PlayEffect, AudioClipName.RobotTalking);
        }
        else
        {
            EventManager.Invoke(SoundManagerTopics.PlayEffect, AudioClipName.Reptilian);
        }
    }
Пример #2
0
    public void handleAnswer(Meaning nostro)
    {
        Debug.Log(nostro);

        if (nostro.Equals(Meaning.PEACE))
        {
            if (lastMeaning.Equals(Meaning.PEACE))
            {
                Debug.Log("RIGHT");
                spaceShip.DisableCircleCollider2D();
                spaceShip.StopCoroutineCustom();
                symbols.spawnParticles(Meaning.PEACE);
                spaceShip.Jump();
                pointMgr.spaceShipRight(spaceShip.remainingTimePerc);
                StartCoroutine(delayedGamePhase(2.5f));
            }
            else
            {
                Debug.Log("WRONG");
                spaceShip.DisableCircleCollider2D();
                spaceShip.StopCoroutineCustom();
                pointMgr.spaceShipWrong();
                spaceShip.attack();
                StartCoroutine(delayedGamePhase(3.2f));
                symbols.spawnParticles(Meaning.WAR);
                UtilitiesGen.CallMethod(1.8f, () => { spaceShip.Jump(); });
            }
        }
        else if (nostro.Equals(Meaning.WAR))
        {
            if (lastMeaning.Equals(Meaning.WAR))
            {
                Debug.Log("RIGHT");
                spaceShip.StopCoroutineCustom();
                pointMgr.spaceShipRight(spaceShip.remainingTimePerc);
                symbols.spawnParticles(Meaning.WAR);
                spaceShip.earthObject.GetComponent <EarthEnergyHandler>().attack();
                StartCoroutine(delayedGamePhase(2f));
            }
            else
            {
                Debug.Log("WRONG");
                spaceShip.StopCoroutineCustom();

                cuori.Play();
                //TODO explosion effect and cuoricino spezzato
                pointMgr.DecreasePoint();
                pointMgr.spaceShipWrong();
                spaceShip.earthObject.GetComponent <EarthEnergyHandler>().attack();

                StartCoroutine(delayedGamePhase(2f));
            }
        }
        else if (nostro.Equals(Meaning.NEUTRAL))
        {
            if (lastMeaning.Equals(Meaning.NEUTRAL))
            {
                spaceShip.StopCoroutineCustom();
                Debug.Log("RIGHT");
                pointMgr.spaceShipRight(spaceShip.remainingTimePerc);
                symbols.spawnParticles(Meaning.NEUTRAL);
                StartCoroutine(delayedGamePhase(2f));
            }
            else
            {
                if (lastMeaning.Equals(Meaning.WAR) || lastMeaning.Equals(Meaning.PEACE))
                {
                    Debug.Log("NEW PHRASE");
                    SymbolsEvents.ActivatePanel(PhraseEvents.GetPhrase(true).symbols);
                    symbols.spawnParticles(Meaning.NEUTRAL);
                }
            }
        }
    }