Beispiel #1
0
    private void SetupLocalPlayer()
    {
        GetComponent <PlayerHealth>().healthBar = GameObject.Find("UI/LifeBars/Player1Bar/GreenBar");
        skill1Cover    = GameObject.Find("UI/SkillSet/Skill1Cover");
        skill1Cooldown = skill1Cover.transform.Find("Text").gameObject.GetComponent <Text>();
        skill2Cover    = GameObject.Find("UI/SkillSet/Skill2Cover");
        skill2Cooldown = skill2Cover.transform.Find("Text").gameObject.GetComponent <Text>();
        skill1Cover.SetActive(false);
        skill2Cover.SetActive(false);

        GameObject skill1thumb = GameObject.Find("UI/SkillSet/Skill1");
        GameObject skill2thumb = GameObject.Find("UI/SkillSet/Skill2");

        GameObject skill1Image = null;
        GameObject skill2Image = null;

        if (characterAttacks is NekoMaidAttacks)
        {
            isNeko = true;
            GameObject.Find("UI/SkillSet/Skill1Name").GetComponent <Text>().text = ConstantsDictionary.NekoSkillOneName;
            GameObject.Find("UI/SkillSet/Skill2Name").GetComponent <Text>().text = ConstantsDictionary.NekoSkillTwoName;
            skill1Image = Instantiate(Resources.Load("UI Prefabs/NekoSkill1", typeof(GameObject))) as GameObject;
            skill2Image = Instantiate(Resources.Load("UI Prefabs/NekoSkill2", typeof(GameObject))) as GameObject;
        }


        if (characterAttacks is OctoChefAttacks)
        {
            isOcto = true;
            GameObject.Find("UI/SkillSet/Skill1Name").GetComponent <Text>().text = ConstantsDictionary.OctoSkillOneName;
            GameObject.Find("UI/SkillSet/Skill2Name").GetComponent <Text>().text = ConstantsDictionary.OctoSkillTwoName;
            skill1Image = Instantiate(Resources.Load("UI Prefabs/OctoSkill1", typeof(GameObject))) as GameObject;
            skill2Image = Instantiate(Resources.Load("UI Prefabs/OctoSkill2", typeof(GameObject))) as GameObject;
        }


        if (characterAttacks is FishermanAttacks)
        {
            isFisherman = true;
            GameObject.Find("UI/SkillSet/Skill1Name").GetComponent <Text>().text = ConstantsDictionary.FishSkillOneName;
            GameObject.Find("UI/SkillSet/Skill2Name").GetComponent <Text>().text = ConstantsDictionary.FishSkillTwoName;
            skill1Image = Instantiate(Resources.Load("UI Prefabs/FishSkill1", typeof(GameObject))) as GameObject;
            skill2Image = Instantiate(Resources.Load("UI Prefabs/FishSkill2", typeof(GameObject))) as GameObject;
        }

        skill1Image.transform.position = skill1Cover.transform.position;
        skill1Image.transform.SetParent(skill1thumb.transform);
        skill2Image.transform.position = skill2Cover.transform.position;
        skill2Image.transform.SetParent(skill2thumb.transform);

        Button btn = GameObject.Find("UI/SkillSet/SkillTree").GetComponent <Button>();

        btn.onClick.AddListener(ShowSkillTree);
        SushiCoins = GameObject.Find("SushiCoinsNumber");

        GameObject localPlayerThumb = GameObject.Find("UI/LifeBars/Player1Bar/LocalPlayerThumbnail");
        GameObject player2Thumb     = GameObject.Find("UI/LifeBars/Player2Bar/Player2Thumbnail");
        GameObject player3Thumb     = GameObject.Find("UI/LifeBars/Player3Bar/Player3Thumbnail");
        GameObject player2healthbar = GameObject.Find("UI/LifeBars/Player2Bar/GreenBar");
        GameObject player3healthbar = GameObject.Find("UI/LifeBars/Player3Bar/GreenBar");


        GameObject localPlayer = null;

        if (isNeko)
        {
            localPlayer = Instantiate(Resources.Load("UI Prefabs/NekoLocalThumbnail", typeof(GameObject))) as GameObject;
        }
        else if (isOcto)
        {
            localPlayer = Instantiate(Resources.Load("UI Prefabs/OctoLocalThumbnail", typeof(GameObject))) as GameObject;
        }
        else if (isFisherman)
        {
            localPlayer = Instantiate(Resources.Load("UI Prefabs/FishermanLocalThumbnail", typeof(GameObject))) as GameObject;
        }
        localPlayer.transform.position = localPlayerThumb.transform.position;
        localPlayer.transform.parent   = localPlayerThumb.transform;
        characterAttacks.GetComponent <PlayerHealth>().currentHealth = characterAttacks.GetComponent <PlayerHealth>().maxHealth;
        CmdGetGameManager(isNeko, isOcto, isFisherman);
    }