public void init(Quest quest) { GameObject quest_UI = this.transform.parent.parent.parent.gameObject; questInformationData = quest_UI.transform.GetChild(0).GetComponent <QuestInformationData>(); this.quest = quest; GameObject questInformation = this.transform.parent.parent.parent.GetChild(0).gameObject; this.questObjectiveWrapper = questInformation.transform.GetChild(questInformation.transform.childCount - 1).gameObject; this.questName = questInformation.transform.GetChild(questInformation.transform.childCount - 2).GetChild(1).GetComponent <Text>(); Debug.Log("QNAME: " + questInformation.name); this.questInformationDescription = questInformation.transform.GetChild(1).gameObject; this.questObjective = questObjectiveWrapper.transform.GetChild(0).gameObject; RectTransform r = questObjective.GetComponent <RectTransform>(); for (int i = 0; i < quest.getCompletionData().completionId.Count; i++) { GameObject o = Instantiate(questObjective); o.transform.SetParent(questObjectiveWrapper.transform); RectTransform rectTransform = o.GetComponent <RectTransform>(); rectTransform.localPosition = r.localPosition; rectTransform.localPosition -= new Vector3(0, 40 * i, 0); rectTransform.sizeDelta = r.sizeDelta; Image im = o.GetComponent <Image>(); Sprite[] sprites = Resources.LoadAll <Sprite>("spritesheet_MonsterIcons"); if (sprites[quest.getImageIndex()] != null) { im.sprite = sprites[quest.getImageIndex()]; } im.enabled = false; Text t = o.GetComponentInChildren <Text>(); t.enabled = false; this.questObjectiveImages.Add(im); this.questObjectiveTexts.Add(t); } this.npcController = GameObject.FindWithTag("NPCManager").GetComponent <NPCController>(); this.questGiver = npcController.getNpcWithQuest(this.getQuest()); Destroy(this.questObjective); }
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!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); }