Esempio n. 1
0
 void FixedUpdate() //Control the enemy spawns here!
 {
     if (SceneManager.GetActiveScene().name == "UI Scale Testing")
     {
         return;
     }
     if (TutorialStatus == null) //Cannot always find the object at the start, since it may not be initialised.
     {
         TutorialStatus = GameObject.FindWithTag("TutorialHandler").GetComponent <TutorialHandler>();
     }
     if (TutorialStatus.GetTutorialStage() > 0)
     {
         return;
     }
     if (SceneManager.GetActiveScene().name != "Game")
     {
         return;
     }
     if (!ui.GetIsPaused()) //Only run timers if the game is not paused. Paused state will also be used for round transitions.
     {
         GameObject[] wave1Enemies = waveArrays[currentWave - 1].wave;
         if (numberEnemiesSpawned == wave1Enemies.Length) //Ignore timers once all enemies have been spawned.
         {
             EnemySpawnTime[currentWave - 1] = 256;
         }
         EnemySpawnTime[currentWave - 1] = EnemySpawnTime[currentWave - 1] - Time.deltaTime;
         if (EnemySpawnTime[currentWave - 1] <= 0)
         {
             Spawn();
             numberEnemiesSpawned            = numberEnemiesSpawned + 1;
             EnemySpawnTime[currentWave - 1] = EnemySpawnTimeDupe[currentWave - 1]; //Reset timer.
         }
     }
 }
    // called once when UICanvasHandler is instantiated
    private void Start()
    {
        #region onClickListeners
        AudioClip[] pageTurnSounds = new AudioClip[]
        {
            SoundManager.pageTurn1,
            SoundManager.pageTurn2,
            SoundManager.pageTurn3
        };
        // set onclick listeners once in the game
        spellbookMainButton.GetComponent <Button>().onClick.AddListener(() =>
        {
            SoundManager.instance.PlaySingle(pageTurnSounds[Random.Range(0, pageTurnSounds.Length)]);
            SceneManager.LoadScene("SpellbookScene");
        });
        libraryButton.GetComponent <Button>().onClick.AddListener(() =>
        {
            SoundManager.instance.PlaySingle(pageTurnSounds[Random.Range(0, pageTurnSounds.Length)]);
            SceneManager.LoadScene("LibraryScene");
        });
        questButton.GetComponent <Button>().onClick.AddListener(() =>
        {
            SoundManager.instance.PlaySingle(pageTurnSounds[Random.Range(0, pageTurnSounds.Length)]);
            SceneManager.LoadScene("QuestLogScene");
        });
        progressButton.GetComponent <Button>().onClick.AddListener(() =>
        {
            SoundManager.instance.PlaySingle(pageTurnSounds[Random.Range(0, pageTurnSounds.Length)]);
            SceneManager.LoadScene("SpellbookProgress");
        });

        // set onclick listeners for main scene buttons
        spellbookButton.GetComponent <Button>().onClick.AddListener(() =>
        {
            SoundManager.instance.PlaySingle(SoundManager.spellbookopen);
            ActivateSpellbookButtons(true);
            SceneManager.LoadScene("SpellbookScene");
        });
        inventoryButton.GetComponent <Button>().onClick.AddListener(() =>
        {
            SoundManager.instance.PlaySingle(SoundManager.inventoryOpen);
            SceneManager.LoadScene("InventoryScene");
        });
        scanButton.GetComponent <Button>().onClick.AddListener(() =>
        {
            SoundManager.instance.PlaySingle(SoundManager.selectScan);
            LoadHandler.instance.sceneBuildIndex = 3;
            SceneManager.LoadScene("LoadingScene");
            // SceneManager.LoadScene("VuforiaScene");
        });
        #endregion

        tutorialHandler = GameObject.Find("tutorialHandler").GetComponent <TutorialHandler>();

        // initially position the buttons properly on main player scene
        spellbookButton.transform.localPosition = new Vector3(-530, -1060, 0);
        diceButton.transform.localPosition      = new Vector3(-180, -1060, 0);
        scanButton.transform.localPosition      = new Vector3(180, -1060, 0);
        inventoryButton.transform.localPosition = new Vector3(530, -1060, 0);
    }
Esempio n. 3
0
 void Awake()
 {
     playersInTwoPlayerMap = 2;
     if (tutorialflag)
     {
         tutorial = GameObject.Find("Tutorial").GetComponent <TutorialHandler>();
     }
 }
        private async Task InvokeTutorialHandlersAsync(TutorialHandler handlers, Tutorial tutorial)
        {
            if (handlers == null)
            {
                return;
            }

            IEnumerable <Task> tasks = handlers
                                       .GetInvocationList()
                                       .Cast <TutorialHandler>()
                                       .Select(handler => handler(tutorial));

            await Task.WhenAll(tasks);
        }
Esempio n. 5
0
 public void RegistTutorial(TutorialHandler handle)
 {
     if (tutorial == handle)
     {
         tutorial = null;
     }
     else
     {
         tutorial = handle;
         if (tutorialFlag != null)
         {
             tutorialFlag();
             tutorialFlag = null;
         }
     }
 }
Esempio n. 6
0
    void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else
        {
            DestroyImmediate(gameObject);
        }

        if (GameController.TutorialEnabled)
        {
            ActivateTutorialCars = false;
            TutorialStatus       = true;
        }
    }
Esempio n. 7
0
    bool enemyIsDead = false; //Prevent multiple point additions!

    // Start is called before the first frame update
    void Start()
    {
        enemyAnimations       = this.GetComponent <Animator>();
        attackTime            = this.gameObject.GetComponentInChildren <EnemyAttack>().attackSpeed;
        attackSpeed           = attackTime;
        pauseCheck            = GameObject.Find("UIHandler").GetComponent <UIController>();
        progressionController = GameObject.Find("ProgressionHandler").GetComponent <Progression>();
        powerScaleCheck       = GameObject.Find("PowerHandler").GetComponent <PowerBehaviour>();
        i = GetComponent <Rigidbody>();
        startingScaleX = transform.localScale.x;
        startingScaleY = transform.localScale.y;
        startingScaleZ = transform.localScale.z;
        inflatedScaleX = startingScaleX * INFLATED_POWER_SCALE;
        inflatedScaleY = startingScaleY * INFLATED_POWER_SCALE;
        inflatedScaleZ = startingScaleZ * INFLATED_POWER_SCALE;
        animator       = GetComponent <Animator>();
        TutorialStatus = GameObject.FindWithTag("TutorialHandler").GetComponent <TutorialHandler>();
    }
Esempio n. 8
0
 /// <summary>
 /// Called within Map Context.
 /// Sends initial packets
 /// </summary>
 private void OnLogin()
 {
     InstanceHandler.SendDungeonDifficulty(this);
     CharacterHandler.SendVerifyWorld(this);
     AccountDataHandler.SendAccountDataTimes(m_client);
     VoiceChatHandler.SendSystemStatus(this, VoiceSystemStatus.Disabled);
     // SMSG_GUILD_EVENT
     // SMSG_GUILD_BANK_LIST
     CharacterHandler.SendBindUpdate(this, BindLocation);
     TutorialHandler.SendTutorialFlags(this);
     SpellHandler.SendSpellsAndCooldowns(this);
     CharacterHandler.SendActionButtons(this);
     FactionHandler.SendFactionList(this);
     // SMSG_INIT_WORLD_STATES
     // SMSG_EQUIPMENT_SET_LIST
     AchievementHandler.SendAchievementData(this);
     // SMSG_EXPLORATION_EXPERIENCE
     CharacterHandler.SendTimeSpeed(this);
     TalentHandler.SendTalentGroupList(m_talents);
     AuraHandler.SendAllAuras(this);
     // SMSG_PET_GUIDS
 }
Esempio n. 9
0
 protected void InitTutorialUc(PageName obj)
 {
     Tutorial = new TutorialUc(TutorialHandler.GetTutorials(Tutorials, obj));
 }
Esempio n. 10
0
    //Power1 is true if it is the LEFT power chosen. Otherwise, it is false (RIGHT power).
    public void LosePower(bool Power1)
    {
        UIController   ui               = GameObject.Find("UIHandler").GetComponent <UIController>();
        PowerBehaviour powers           = GameObject.Find("PowerHandler").GetComponent <PowerBehaviour>();
        Progression    progressionCheck = GameObject.Find("ProgressionHandler").GetComponent <Progression>();
        GameObject     audioController;

        audioController = GameObject.FindGameObjectWithTag("MusicHandler");
        audioController.GetComponent <AudioController>().PlayMusic(0);
        TutorialHandler TutStatus = GameObject.FindWithTag("TutorialHandler").GetComponent <TutorialHandler>();

        if (TutStatus.GetTutorialStage() > 0)
        {
            TutStatus.PowerDrained();
        }
        if (Power1)
        {
            powers.LoseSpecificPower(ui.losePower1);
            switch (powers.powerHandler[ui.losePower1].PowerStrength)
            {
            case 3:
            {
                ui.AddPoints((progressionCheck.GetMaximumWaves() - progressionCheck.GetCurrentWave()) * 500);
                break;
            }

            case 2:
            {
                ui.AddPoints((progressionCheck.GetMaximumWaves() - progressionCheck.GetCurrentWave()) * 250);
                break;
            }

            case 1:
            {
                break;
            }

            default:
            {
                break;
            }
            }
        }
        else
        {
            powers.LoseSpecificPower(ui.losePower2);
            switch (powers.powerHandler[ui.losePower2].PowerStrength)
            {
            case 3:
            {
                ui.AddPoints((progressionCheck.GetMaximumWaves() - progressionCheck.GetCurrentWave()) * 500);
                break;
            }

            case 2:
            {
                ui.AddPoints((progressionCheck.GetMaximumWaves() - progressionCheck.GetCurrentWave()) * 250);
                break;
            }

            case 1:
            {
                break;
            }

            default:
            {
                break;
            }
            }
        }
        ui.setLockPauseMenu(false);
        ui.returnToMainGame();
        Cursor.lockState = CursorLockMode.None;
        if (TutStatus.GetTutorialStage() > 0) //Skip weapon selection.
        {
            progressionCheck.SetWaveComplete(false);
            Cursor.lockState = CursorLockMode.Locked;
            return;
        }
        ui.WeaponSelection();
        progressionCheck.SetWaveComplete(false);
    }
Esempio n. 11
0
    // Update is called once per frame
    void Update()
    {
        opponentBP = opponent.currentBp;
        playerBP   = player.bp;

        if (!gc.isTutMode) //PLEASE REMEMBER TO SET THIS VAR TO TRUE AT THE BEG OF THE GAME!
        {
            if (!CheckIfItsOver())
            {
                if (!isPlayerTurn)
                {
                    if (gc.tutTracker == 2 || gc.tutTracker > 5)
                    {
                        if (actionTimer > 0)
                        {
                            actionTimer -= Time.deltaTime;
                        }
                        else
                        {
                            if (!actionChosen)
                            {
                                if (gc.tutTracker == 2)
                                {
                                    oa.ChooseRandomMove();
                                }
                                else
                                {
                                    int randAction = 0;
                                    randAction = Random.Range(0, 50);

                                    if (randAction > 2)
                                    {
                                        oa.ChooseRandomMove();
                                    }
                                    else
                                    {
                                        oa.BeQuirky();
                                    }
                                }
                                gc.tutTracker++;
                                actionChosen = true;
                            }
                        }
                    }
                    else
                    {
                        if (!actionChosen)
                        {
                            if (gc.tutTracker < 4)
                            {
                                gc.tutTracker++;
                                TutorialHandler tutC = FindObjectOfType <TutorialHandler>();
                                tutC.wordTracker = -1;
                                tutC.BeginText(tutC.tutWords[gc.tutTracker].lines);
                                isPlayerTurn = true;
                                gc.isTutMode = true;
                            }
                            else if (gc.tutTracker == 5)
                            {
                                TutorialHandler tutC = FindObjectOfType <TutorialHandler>();
                                tutC.BeginText(tutC.tutWords[4].lines);
                                isPlayerTurn = true;
                                gc.isTutMode = true;
                            }
                            else
                            {
                                TutorialHandler tutC = FindObjectOfType <TutorialHandler>();
                                tutC.wordTracker = -1;
                                tutC.BeginText(tutC.tutWords[gc.tutTracker].lines);
                                isPlayerTurn = true;
                                gc.isTutMode = true;
                            }
                        }
                    }
                }
                else
                {
                    if (gc.tutTracker == 3)
                    {
                        TutorialHandler tutC = FindObjectOfType <TutorialHandler>();
                        tutC.wordTracker = -1;
                        tutC.BeginText(tutC.tutWords[gc.tutTracker].lines);
                        isPlayerTurn = true;
                        gc.isTutMode = true;
                        gc.tutTracker++;
                    }
                }
            }
            else
            {
                if (!doOnce)
                {
                    if (didWin)
                    {
                        // ac.PlaySFX(gc.ac.battleNoises[3]);
                        gc.opponents[gc.GetTwin(opponent._name)].isDefeated = true;
                        dh.DisplayBattleText("Battle over!\nYou didn't break down yet! :D ");

                        ac.SwitchSong(ac.hallwayMusic);
                        sc.WaitThenTransitionAndLoad("Hallway", 3f, 2);
                        doOnce = true;
                    }
                    else
                    {
                        // ac.PlaySFX(gc.ac.battleNoises[4]);
                        gc.opponents[gc.GetTwin(opponent._name)].isDefeated = true;
                        gc.playerLost = true;
                        player.playerHolder.SetActive(true);
                        dh.DisplayBattleText("Battle over!\n...You're highkey panicking.");

                        ac.SwitchSong(ac.hallwayMusic);
                        sc.WaitThenTransitionAndLoad("Hallway", 3f, 2);
                        doOnce = true;
                    }
                }
            }
        }
    }
Esempio n. 12
0
 // Use this for initialization
 void Start()
 {
     tutorialHandler = FindObjectOfType <TutorialHandler>();
     ResourceManager.instance.StopPlayTheGame();
 }
Esempio n. 13
0
 void Awake()
 {
     Instance = this;
 }
Esempio n. 14
0
        public static void HandleAuthResponse(ref PacketReader packet, ref WorldClass session)
        {
            BitUnpack BitUnpack = new BitUnpack(packet);

            packet.Skip(54);

            int addonSize = packet.ReadInt32();

            packet.Skip(addonSize);

            uint   nameLength  = BitUnpack.GetNameLength <uint>(12);
            string accountName = packet.ReadString(nameLength);

            SQLResult result = DB.Realms.Select("SELECT * FROM accounts WHERE name = '{0}'", accountName);

            if (result.Count == 0)
            {
                session.clientSocket.Close();
            }
            else
            {
                session.Account = new Account()
                {
                    Id         = result.Read <int>(0, "id"),
                    Name       = result.Read <String>(0, "name"),
                    Password   = result.Read <String>(0, "password"),
                    SessionKey = result.Read <String>(0, "sessionkey"),
                    Expansion  = result.Read <byte>(0, "expansion"),
                    GMLevel    = result.Read <byte>(0, "gmlevel"),
                    IP         = result.Read <String>(0, "ip"),
                    Language   = result.Read <String>(0, "language")
                }
            };

            string K = session.Account.SessionKey;

            byte[] kBytes = new byte[K.Length / 2];

            for (int i = 0; i < K.Length; i += 2)
            {
                kBytes[i / 2] = Convert.ToByte(K.Substring(i, 2), 16);
            }

            session.Crypt.Initialize(kBytes);

            uint      realmId          = WorldConfig.RealmId;
            SQLResult realmClassResult = DB.Realms.Select("SELECT class, expansion FROM realm_classes WHERE realmId = '{0}'", realmId);
            SQLResult realmRaceResult  = DB.Realms.Select("SELECT race, expansion FROM realm_races WHERE realmId = '{0}'", realmId);

            bool HasAccountData = true;
            bool IsInQueue      = false;

            PacketWriter authResponse = new PacketWriter(JAMCMessage.AuthResponse);
            BitPack      BitPack      = new BitPack(authResponse);

            BitPack.Write(1);                                      // HasAccountData

            if (HasAccountData)
            {
                BitPack.Write(realmClassResult.Count, 25);         // Activation count for classes
                BitPack.Write(0);                                  // Unknown, 5.0.4
                BitPack.Write(0);                                  // Unknown, 5.1.0
                BitPack.Write(0, 22);                              // Activate character template windows/button

                //if (HasCharacterTemplate)
                //Write bits for char templates...

                BitPack.Write(realmRaceResult.Count, 25);          // Activation count for races
                BitPack.Write(IsInQueue);                          // IsInQueue
            }

            if (IsInQueue)
            {
                BitPack.Write(0);                                  // Unknown
                BitPack.Flush();

                authResponse.WriteUInt32(0);                       // QueuePosition
            }
            else
            {
                BitPack.Flush();
            }

            if (HasAccountData)
            {
                //if (HasCharacterTemplate)
                //Write data for char templates...

                for (int r = 0; r < realmRaceResult.Count; r++)
                {
                    authResponse.WriteUInt8(realmRaceResult.Read <byte>(r, "expansion"));
                    authResponse.WriteUInt8(realmRaceResult.Read <byte>(r, "race"));
                }

                authResponse.WriteUInt32(0);
                authResponse.WriteUInt32(0);
                authResponse.WriteUInt8(0);
                authResponse.WriteUInt8(session.Account.Expansion);
                authResponse.WriteUInt8(session.Account.Expansion);

                for (int c = 0; c < realmClassResult.Count; c++)
                {
                    authResponse.WriteUInt8(realmClassResult.Read <byte>(c, "class"));
                    authResponse.WriteUInt8(realmClassResult.Read <byte>(c, "expansion"));
                }

                authResponse.WriteUInt32(0);
            }

            authResponse.WriteUInt8((byte)AuthCodes.AUTH_OK);

            session.Send(authResponse);

            MiscHandler.HandleUpdateClientCacheVersion(ref session);
            TutorialHandler.HandleTutorialFlags(ref session);
        }
    }
Esempio n. 15
0
 public void Awake()
 {
     instance = this;
 }