Exemplo n.º 1
0
    void OnGUI()
    {
        // Resize GUI
        Vector2 resizeRatio = new Vector2((float)Screen.width / nativeWidth, (float)Screen.height / nativeHeight);

        GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(resizeRatio.x, resizeRatio.y, 1.0f));

        if (isClicked)
        {
            // Set custom GUI skin
            GUI.skin = mySkin;

            // If the Enter button is clicked and a character has been chosen, the player spawns in the game and all character
            // prefabs are destroyed from the character selection menu.
            if (GUI.Button(EnterButton, buttonName))
            {
                soundEffects.PlayAudio(4);

                if (spawn.amIOnTheRedTeam)
                {
                    spawn.SpawnRedTeamPlayer();

                    Destroy(GameObject.Find("Troll(Clone)"));
                    Destroy(GameObject.Find("Goblin(Clone)"));
                    Destroy(GameObject.Find("Warlord(Clone)"));
                    Destroy(GameObject.Find("Necromancer(Clone)"));
                    Destroy(GameObject.Find("Demon(Clone)"));
                }

                if (spawn.amIOnTheBlueTeam)
                {
                    spawn.SpawnBlueTeamPlayer();

                    Destroy(GameObject.Find("Troll(Clone)"));
                    Destroy(GameObject.Find("Goblin(Clone)"));
                    Destroy(GameObject.Find("Warlord(Clone)"));
                    Destroy(GameObject.Find("Necromancer(Clone)"));
                    Destroy(GameObject.Find("Demon(Clone)"));
                }
                enabled = false;
            }

            // Character and skills description
            if (selectedPlayer == 1)
            {
                description        = "A fearless creature born from mud and ashes of a mythical burnt forest, came to life to defend nature.";
                skill1_Description = "Unleashes energy, gathered from the ground heat to greatly double his Attack Speed for 5sec.";
                skill2_Description = "Smashes the enemy with the Fist of Nature, relic of the Temple of Erth, dealing damage equal to Troll's Spell Damage.";
                window_Title       = "TROLL";

                skill1 = Ch1Skill1;
                skill2 = Ch1Skill2;

                windowRect = GUI.Window(2, windowRect, WindowFunction, window_Title);
            }
            if (selectedPlayer == 2)
            {
                description        = "Necromancer casts powerful sorceries, increasing his effectiveness by the spirit of the deceased. Using this extremely rare power, Necromancer can be very useful in team battles.";
                skill1_Description = "Cast an area of effect spell. Deal 20 damage to all enemies and heal all allies by 40.";
                skill2_Description = "Increase Speed by 50 and Mana regeneration by 5 for 5sec.";
                window_Title       = "NECROMANCER";

                skill1 = Ch2Skill1;
                skill2 = Ch2Skill2;

                windowRect = GUI.Window(2, windowRect, WindowFunction, window_Title);
            }
            if (selectedPlayer == 3)
            {
                description        = "A master of the archery. Picking the right target with precision, the Goblin can strike the opponent dealing extreme amounts of damage while slowing the opponent";
                skill1_Description = "Launch a big fire arrow. A powerful ability that duplicates the hero's spell power and deals that damage to the opponent.";
                skill2_Description = "Fire arrows in a cone, dealing 30 spell damage to multiple enemies, and slows the targets for 5sec";
                window_Title       = "GOBLIN";

                skill1 = Ch3Skill1;
                skill2 = Ch3Skill2;

                windowRect = GUI.Window(2, windowRect, WindowFunction, window_Title);
            }
            if (selectedPlayer == 4)
            {
                description        = "Commander of Reptilians, Warlord is against to anyone who stands kati conquering the Enchanted Forest.";
                skill1_Description = "Heals hero by 25. The healing received is always equal to Warlord's spell damage.";
                skill2_Description = "Stabs the target, dealing 3,5 bleed damage per second for 5 sec.";
                window_Title       = "WARLORD";

                skill1 = Ch4Skill1;
                skill2 = Ch4Skill2;

                windowRect = GUI.Window(2, windowRect, WindowFunction, window_Title);
            }
            if (selectedPlayer == 5)
            {
                description        = "Through his travels, seeking the mysteries behind demon creation, Demon became wise and strong and managed to craft and manipulate the elements of Nature.";
                skill1_Description = "Spawns ice shards in an area beneath his enemies, dealing 25 damage.";
                skill2_Description = "Releases strong wind from his potion, dealing half Spell Damage and slowing the enemy.";
                window_Title       = "DEMON";

                skill1 = Ch5Skill1;
                skill2 = Ch5Skill2;

                windowRect = GUI.Window(2, windowRect, WindowFunction, window_Title);
            }
        }
    }
Exemplo n.º 2
0
    void ReadyRPC(int currentSlotRPC, PhotonPlayer Owner)
    {
        //if (PhotonNetwork.isMasterClient)
        //{
        GameObject particleCamObj = GameObject.Find("CameraParticle");

        particleCamObj.SetActive(false);
        clientScript.ShowGameMenu();
        //Destroy(charRectObj);

        charSlotCount = 0;
        foreach (GameObject slot in allslots)
        {
            Char_Slot tmpSlot = slot.GetComponent <Char_Slot>();

            if (tmpSlot.slotNumber == currentSlotRPC)
            {
                tmpSlot.isReady = true;
            }
        }
        foreach (GameObject charSlot in allCharslots)
        {
            Char_Pick tmp = charSlot.GetComponent <Char_Pick>();
            tmp.charButton.interactable = false;
            //Destroy(charSlot);
        }

        foreach (GameObject slot in allslots)
        {
            Char_Slot tmpSlot = slot.GetComponent <Char_Slot>();

            if (tmpSlot.slotNumber == currentSlotRPC && tmpSlot.networkOwner == Owner)
            {
                tmpSlot.isReady = true;
                //networkView.RPC("ReadyRPC", Owner, currentSlotRPC, uLink.Network.player);

                //CHARACTER SPAWN
                if (currentSlotRPC % 2 == 1)
                {
                    //transform.parent = null;
                    //Application.LoadLevel("MainScene");
                    //Debug.Log("test");

                    GameObject  spawnManager = GameObject.Find("SpawnManager_mn");
                    SpawnScript SpawnScr     = spawnManager.GetComponent <SpawnScript>();

                    for (int i = 0; i < charPickList.Count; i++)
                    {
                        if (charPickList[i].characterName == tmpSlot.charName)
                        {
                            //Debug.Log(charPickList[i].charPrefabDir);
                            //Debug.Log(tmpSlot.charName);
                            //charPickedDir = charPickList[i].charPrefabDir;
                            //charPickedName = tmpSlot.charName;
                            //charPickedTeam = "red";
                            SpawnScr.SpawnBlueTeamPlayer(Owner, charPickList[i].charPrefabDir, tmpSlot.charName);
                            return;
                        }
                    }
                }
                else
                {
                    GameObject  spawnManager = GameObject.Find("SpawnManager_mn");
                    SpawnScript SpawnScr     = spawnManager.GetComponent <SpawnScript>();
                    for (int i = 0; i < charPickList.Count; i++)
                    {
                        if (charPickList[i].characterName == tmpSlot.charName)
                        {
                            //charPickedDir = charPickList[i].charPrefabDir;
                            //harPickedName = tmpSlot.charName;
                            //charPickedTeam = "blue";
                            SpawnScr.SpawnRedTeamPlayer(Owner, charPickList[i].charPrefabDir, tmpSlot.charName);
                            return;
                        }
                    }
                }
            }

            //}
        }
        //if (uLink.Network.isClient)
        //{

        //}
    }
Exemplo n.º 3
0
    void ReadyRPC(int currentSlotRPC, uLink.NetworkPlayer Owner)
    {
        if (uLink.Network.isServer)
        {
            foreach (GameObject slot in allslots)
            {
                Char_Slot tmpSlot = slot.GetComponent <Char_Slot>();

                if (tmpSlot.slotNumber == currentSlotRPC && tmpSlot.networkOwner == Owner)
                {
                    tmpSlot.isReady = true;
                    networkView.RPC("ReadyRPC", Owner, currentSlotRPC, uLink.Network.player);

                    //CHARACTER SPAWN
                    if (currentSlotRPC % 2 == 1)
                    {
                        GameObject  spawnManager = GameObject.Find("SpawnManager_mn");
                        SpawnScript SpawnScr     = spawnManager.GetComponent <SpawnScript>();

                        for (int i = 0; i < charPickList.Count; i++)
                        {
                            if (charPickList[i].characterName == tmpSlot.charName)
                            {
                                Debug.Log("Spawn Blue");
                                SpawnScr.SpawnBlueTeamPlayer(Owner, charPickList[i].charPrefabDir, tmpSlot.charName);
                                return;
                            }
                        }
                    }
                    else
                    {
                        GameObject  spawnManager = GameObject.Find("SpawnManager_mn");
                        SpawnScript SpawnScr     = spawnManager.GetComponent <SpawnScript>();
                        for (int i = 0; i < charPickList.Count; i++)
                        {
                            if (charPickList[i].characterName == tmpSlot.charName)
                            {
                                Debug.Log("Spawn Red");
                                SpawnScr.SpawnRedTeamPlayer(Owner, charPickList[i].charPrefabDir, tmpSlot.charName);
                                return;
                            }
                        }
                    }
                }
            }
        }
        if (uLink.Network.isClient)
        {
            GameObject particleCamObj = GameObject.Find("CameraParticle");
            particleCamObj.SetActive(false);
            clientScript.ShowGameMenu();
            Destroy(charRectObj);

            charSlotCount = 0;
            foreach (GameObject slot in allslots)
            {
                Char_Slot tmpSlot = slot.GetComponent <Char_Slot>();

                if (tmpSlot.slotNumber == currentSlotRPC)
                {
                    tmpSlot.isReady = true;
                }
            }
            foreach (GameObject charSlot in allCharslots)
            {
                Char_Pick tmp = charSlot.GetComponent <Char_Pick>();
                tmp.charButton.interactable = false;
                Destroy(charSlot);
            }
        }
    }