예제 #1
0
    public override void OnStartLocalPlayer()
    {
        ClientScene.RegisterPrefab((GameObject)Resources.Load("Prefabs/Enemy"));
        ClientScene.RegisterPrefab((GameObject)Resources.Load("Particles/Hit"));
        ClientScene.RegisterPrefab((GameObject)Resources.Load("Particles/ImpactOnGround"));

        this.movement = GetComponent <PlayerMovement>();

        this.skillUi = GameObject.Find("Actionbar_UI").GetComponent <SkillUIManager>();
        this.skillUi.init(this);
        this.skillManager = GetComponent <SkillManager>();
        this.skillManager.init(this);

        UICanvas = GameObject.Find("UI");
        chat     = Tools.getChild(UICanvas, "Chat_UI").GetComponent <Chat>();
        network  = GetComponent <playerNetwork>();
        network.initialize(this);
        chat.setPlayer(this);
        camera         = Camera.main;
        this.inventory = this.GetComponent <Inventory> ();
        this.inventory.init(this);

        camera.GetComponent <MainCamera> ().player = this.gameObject;
        camera.GetComponent <MainCamera> ().setState((int)e_cameraStates.DEFAULT);
        for (int i = 0; i < prefabsToRegister.Length; i++)
        {
            //ClientScene.RegisterPrefab (prefabsToRegister [i]);
        }
    }
예제 #2
0
    public override void OnStartLocalPlayer()
    {
        if (!isLocalPlayer)
        {
            return;
        }
        commandManager = new CommandManager(this);
        for (int i = 0; i < prefabsToRegister.Length; i++)
        {
            ClientScene.RegisterPrefab(prefabsToRegister [i]);
        }
        ResourceStructure.initilize();

        /*
         * ClientScene.RegisterPrefab((GameObject)Resources.Load("Prefabs/Enemy"));
         * ClientScene.RegisterPrefab((GameObject)Resources.Load("Particles/Hit"));
         * ClientScene.RegisterPrefab((GameObject)Resources.Load("Particles/ImpactOnGround"));
         * ClientScene.RegisterPrefab(skillPrefab);
         * ClientScene.RegisterPrefab(skillEffectPrefab);*/
        //UI
        UICanvas      = GameObject.Find("UI");
        login         = Tools.findInactiveChild(UICanvas, "Login_UI").GetComponent <Login>();
        this.movement = GetComponent <PlayerMovement>();
        //skills
        this.skillUi = Tools.findInactiveChild(UICanvas, "Actionbar_UI").GetComponent <SkillUIManager>();
        this.skillUi.init(this);
        this.skillManager = GetComponent <SkillManager>();
        this.skillManager.init(this, getSkillUiManager());

        //this.skillTreeUi = GameObject.Find(this.skillTreeUi.name)

        //network
        network = GetComponent <playerNetwork>();
        network.initialize(this);

        this.skillTreeUi = Tools.getChild(UICanvas, this.skillTreeUi.name);

        //chat
        chat = Tools.getChild(UICanvas, "Chat_UI").GetComponent <Chat>();
        chat.setPlayer(this);

        //inventory
        this.inventory = this.GetComponent <Inventory> ();
        this.inventory.init(this);

        //equip
        equip = Tools.getChild(UICanvas, "Equipment_UI").GetComponent <EquipmentHandler>();
        equip.setEquipmentUI(Tools.getChild(UICanvas, "Equipment_UI"));
        equip.setPlayer(this);

        //camera
        camera = Camera.main;
        camera.GetComponent <MainCamera> ().player = this.gameObject;
        camera.GetComponent <MainCamera> ().setState((int)e_cameraStates.DEFAULT);

        //worlds
        worlds[0] = GameObject.Find("login_World");
        worlds[1] = GameObject.Find("World");


        //TempQuestUI
        GameObject tempQuestUI = Instantiate(this.quest_UI);

        this.questInformationData = tempQuestUI.GetComponentInChildren <QuestInformationData>();
        tempQuestUI.transform.SetParent(this.getUI().transform);
        tempQuestUI.transform.SetAsLastSibling();
        tempQuestUI.SetActive(false);
        questInformationObject = tempQuestUI;

        //QuestWrapper
        questWrapper = getUI().transform.GetChild(getUI().transform.childCount - 1).GetChild(1).GetChild(0).GetComponent <QuestWrapper>();

        //UIPlayer
        this.UIPlayer = Tools.findInactiveChild(UICanvas, "Footer_UI").GetComponent <UIPlayerHandler>();
        this.UIPlayer.setPlayer(this);
        this.UIPlayer.gameObject.SetActive(true);
        this.UIPlayer.updateInfo();

        this.UIActionBar = Tools.findInactiveChild(UICanvas, "Actionbar_UI");
        UIActionBar.SetActive(true);
        this.uiStats = Tools.findInactiveChild(UICanvas, "Stat_UI").GetComponent <UIStats>();
        uiStats.gameObject.SetActive(false);
        Debug.Log("STATS: " + this.stats.s_str);

        this.UIDeath = Tools.findInactiveChild(this.getUI(), "Death_UI");
        this.UIDeath.SetActive(true);
        this.UIDeath.GetComponent <GraveStone>().player = this;
        this.UIDeath.SetActive(false);

        //QuestManager
        this.npcController = GameObject.FindWithTag("NPCManager").GetComponent <NPCController>();
        npcController.initilize(this);

        identity = this.GetComponent <NetworkIdentity>();
        Debug.Log("INFO1!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
    }