Exemplo n.º 1
0
    void Start()
    {
        playerInfo = gameObject.GetComponent<PlayerInfo>();
        GameObject.DontDestroyOnLoad(gameObject);

        if (isServer) {
            if (role == PlayerRole.Striker) {
                transform.GetChild(1).GetChild(0).GetChild(0).position = new Vector3(-5.06f, 1.19f, 13.7f);
                transform.GetChild(1).GetChild(0).GetChild(1).position = new Vector3(-5.06f, 1.19f, 13.7f);
                transform.GetChild(1).GetChild(1).GetChild(0).position = new Vector3(5.06f, 1.19f, 13.7f);
                transform.GetChild(1).GetChild(1).GetChild(1).position = new Vector3(5.06f, 1.19f, 13.7f);

                strikerUlti.transform.position = new Vector3(0, 3.6f, 4.3f);
                strikerUlti.transform.GetChild(0).localPosition = new Vector3(0, -0.18f, 8.46f);
                strikerUlti.transform.GetChild(2).GetChild(0).localPosition = new Vector3(-4.18f, -1.74f, 8.66f);
                strikerUlti.transform.GetChild(2).GetChild(1).localPosition = new Vector3(-4.18f, -1.74f, 8.66f);

                strikerUlti.transform.GetChild(3).GetChild(0).localPosition = new Vector3(4.18f, -1.74f, 8.66f);
                strikerUlti.transform.GetChild(3).GetChild(1).localPosition = new Vector3(4.18f, -1.74f, 8.66f);

                strikerUlti.transform.GetChild(0).GetChild(1).GetComponent<ParticleSystem>().emissionRate = 5;
                strikerUlti.transform.GetChild(0).GetChild(1).GetComponent<ParticleSystem>().startSize = 3;
                strikerUlti.transform.GetChild(0).GetChild(2).GetComponent<ParticleSystem>().emissionRate = 100;
                strikerUlti.transform.GetChild(0).GetChild(2).GetComponent<ParticleSystem>().startSize = 0.7f;
                strikerUlti.transform.GetChild(0).GetChild(2).GetComponent<ParticleSystem>().gameObject.transform.localScale = new Vector3(1, 1, 1);

            }
            else {
                defenderUlti.transform.position = new Vector3(0, 3.16f, 8.52f);
                defenderUlti.transform.localScale = new Vector3(2, 1, 1);

                defenderUlti.transform.GetChild(0).localPosition = new Vector3(0, -0.45f, 8.21f);
                defenderUlti.transform.GetChild(0).GetComponent<ParticleSystem>().startSize = 3;
                defenderUlti.transform.GetChild(0).GetComponent<ParticleSystem>().startSpeed = 0.9f;

                defenderUlti.transform.GetChild(2).GetComponent<ParticleSystem>().startSpeed = 5;
                defenderUlti.transform.GetChild(2).GetComponent<ParticleSystem>().startSize = 1;
                defenderUlti.transform.GetChild(3).GetComponent<ParticleSystem>().startSpeed = 5;
                defenderUlti.transform.GetChild(3).GetComponent<ParticleSystem>().startSize = 1;

            }
        }

        if (isLocalPlayer) {
            ui = (GameObject)Instantiate (uiPrefab, transform.position, Quaternion.identity) as GameObject;
            GameObject.DontDestroyOnLoad(ui);
            NetworkManagerCustom.SingletonNM.DisableLobbyUI();
            setStrikerDefenderControllers(ui);

            cam.enabled = true;

            skillControllers = new SkillController[3];
            for(int i = 0; i <= 1; i++){
                skillControllers[i] = GameObject.Find("Skill" + i + "_Image").GetComponent<SkillController>();
                skillControllers[i].setSkill(playerInfo.getSkill(i));
            }

            skillIndex = 0;

            shieldPoint1 = Vector3.zero;
            shieldExist = false;
            isDraggingCrystal = false;
            scoreText = ui.transform.GetChild(5).GetChild(0).GetComponent<Text>();
            switch (role)
            {
                case PlayerRole.Striker:
                    rank = LoginController.StrikerLevel;
                    exp = LoginController.StrikerExp;
                    break;
                case PlayerRole.Engineer:
                    rank = LoginController.EngineerLevel;
                    exp = LoginController.EngineerExp;
                    break;
                case PlayerRole.Defender:
                    rank = LoginController.DefenderLevel;
                    exp = LoginController.DefenderExp;
                    break;
            }
            CmdChangeRank(rank, exp);
        }
    }