void CreateObjects(GivenOrder go) { switch (go.o) { case Order.BUY: return; case Order.GUARD: go.standArea = Instantiate(guardAreaPrefab); go.standArea.transform.position = go.npc.transform.position; return; case Order.INTIMIDATE: return; case Order.SENTRY: go.standArea = Instantiate(guardAreaPrefab); go.standArea.transform.position = go.npc.transform.position; go.watchArea = Instantiate(watchAreaPrefab); go.watchArea.transform.position = GameManagerScript.ins.player.transform.position; return; case Order.TAUNT: return; case Order.WATCH: go.watchArea = Instantiate(watchAreaPrefab); go.watchArea.transform.position = GameManagerScript.ins.player.transform.position; return; } }
public void UpdateColliders(GivenOrder go) { if (go.standArea != null) { go.standArea.GetComponent <BoxCollider2D>().isTrigger = false; go.standArea.GetComponent <BoxCollider2D>().isTrigger = true; } if (go.watchArea != null) { go.watchArea.GetComponent <BoxCollider2D>().isTrigger = false; go.watchArea.GetComponent <BoxCollider2D>().isTrigger = true; } }
public void ChoiceSelected(int i) { DestroyChoices(); GivenOrder go = new GivenOrder(); go.npc = savedNPC; go.o = (Order)i; GameObject c = Instantiate(gridlayoutItem, gridlayoutGivenOrders); go.child = c; CreateObjects(go); //update collider when timescale is 0 UpdateColliders(go); givenOrders.Add(go); go.child.GetComponentInChildren <TMPro.TextMeshProUGUI>().text = GetChoiceText(i); CombatManager.ins.combatDrawMovePosition.ChangeSpeechValue(); }
public void RemoveFromOrders(GivenOrder o) { foreach (Transform child in gridlayoutGivenOrders) { if (child.gameObject == o.child) { if (o.standArea != null) { Destroy(o.standArea); } if (o.watchArea != null) { Destroy(o.watchArea); } Destroy(child.gameObject); givenOrders.Remove(o); return; } } }
public void ImportOrderData(uint ID, CombatSpeech.Order o, Vector3 standAreaPos, Vector3 watchAreaPos) { GivenOrder go = new GivenOrder(); go.npc = NPCManagerScript.ins.GetNPCInSceneFromID(ID); go.o = o; GameObject c = Instantiate(gridlayoutItem, gridlayoutGivenOrders); go.child = c; CreateObjects(go); if (go.standArea != null) { go.standArea.transform.position = standAreaPos; } if (go.watchArea != null) { go.watchArea.transform.position = watchAreaPos; } UpdateColliders(go); givenOrders.Add(go); go.child.GetComponentInChildren <TMPro.TextMeshProUGUI>().text = GetChoiceText((int)o); }