private void Awake() { if (prefab_middleWaypoint == null) { prefab_middleWaypoint = Instantiate(prefab_waypoint); prefab_middleWaypoint.Text = "cancel"; prefab_middleWaypoint.name = prefab_waypoint.name + " cancel"; if (prefab_waypoint.transform.parent != prefab_middleWaypoint.transform.parent) { prefab_middleWaypoint.transform.SetParent(prefab_waypoint.transform.parent); } } }
public void ActivateTeamMember(GameObject memberObject) { CharacterControlManager ccm = Global.GetComponent <CharacterControlManager>(); Interact3dItem i3i = ccm.moveProxy.GetComponent <Interact3dItem>(); if (i3i != null) { i3i.showing = true; } ccm.SetCharacter(memberObject); i3i = memberObject.GetComponent <Interact3dItem>(); if (i3i != null) { i3i.showing = false; } }
public void SetCharacter(GameObject obj) { if (moveProxy != null) { //Debug.Log("Switching from " + moveProxy.Target); if (moveProxy.Target != null) { Interact3dItem i3i = moveProxy.Target.GetComponent <Interact3dItem>(); if (i3i != null) { i3i.showing = true; } } } CharacterRoot cm = obj.GetComponent <CharacterRoot>(); if (moveProxy.Target != fourthPersonControl.GetMover()) { cam.target = cm != null && cm.move.head != null ? cm.move.head : obj.transform; moveProxy.Target = cm; } if (cm != null) { cm.move.move.orientationTransform = cam.transform; } clickToMove.SetFollower(cm.move); Transform t = localPlayerInterfaceObject.transform; Interact3dUi.TriggerArea ta = t.GetComponent <Interact3dUi.TriggerArea>(); ta.Blink(); t.SetParent(obj.transform); t.localPosition = Vector3.zero; t.localRotation = Quaternion.identity; // TODO if the Interact3dItem is up, disable it. if (moveProxy != null) { Interact3dItem i3i = moveProxy.GetComponent <Interact3dItem>(); if (i3i != null) { i3i.showing = false; } } }
public void GenerateMore(int len) { for (int i = npcs.Count; i < len; ++i) { Material mat = game.idolCreator.idolMaterials[i]; GameObject npc = Instantiate(prefab_npcPlayer.gameObject); ParticleSystem ps = npc.GetComponentInChildren <ParticleSystem>(); if (ps != null) { ps.name = mat.name; ParticleSystem.MainModule m = ps.main; m.startColor = mat.color; } npc.name = prefab_npcPlayer.name + i; ScriptedDictionary dict = npc.GetComponentInChildren <ScriptedDictionary>(); if (dict != null) { dict["mycolor"] = mat.name; } string foundName; if (npcNames.TryGetValue(mat.name, out foundName)) { npc.name = foundName; } Interact3dItem i3d = npc.GetComponentInChildren <Interact3dItem>(); i3d.Text = npc.name; i3d.internalState.size = 1.75f; i3d.internalState.fontCoefficient = .7f; i3d.OnInteract = () => { DialogManager.Instance.dialogWithWho = npc; DialogManager.Instance.Show(); Tokenizer tok = new Tokenizer(); DialogManager.Instance.StartDialog(npc, tok, "dialog" + mat.name); tok.ShowErrorTo(DialogManager.ActiveDialog.ShowError); ps.Stop(); }; npcs.Add(npc.GetComponent <CharacterRoot>()); } }
public Waypoint(Vector3 p, Act a = Act.Move, float v = 0) { ui = null; positon = p; act = a; value = v; }
public Waypoint(Interact3dItem _ui, Act a = Act.Move, float v = 0) { positon = _ui.transform.position; ui = _ui; act = a; value = v; }
public ListItemUi AddMember(GameObject memberObject) { //Show.Log("adding member " + memberObject); if (members == null) { members = new List <GameObject>(); } // make sure this character adds to the communal inventory! (assuming there is one) TeamMember teamMember = memberObject.GetComponent <TeamMember>(); if (teamMember == null) { teamMember = memberObject.AddComponent <TeamMember>(); } // add them to the roster if (members.IndexOf(memberObject) < 0) { members.Add(memberObject); teamMember.onJoinTeam?.Invoke(this); CharacterRoot cr = memberObject.GetComponent <CharacterRoot>(); if (cr) { EventBind.IfNotAlready(cr.activateFunction, this, ActivateTeamMember); } } if (members.Count > 1) { if (prev) { prev.gameObject.SetActive(true); } if (next) { next.gameObject.SetActive(true); } if (team) { team.gameObject.SetActive(true); } } if (rosterUi != null) { ListItemUi result = rosterUi.GetListItemUi(memberObject); if (result != null) { //Show.Log("already ui"); return(result); } } string name = teamMember != null ? teamMember.name : null; if (string.IsNullOrEmpty(name)) { name = memberObject.name; } Interact3dItem i3i = teamMember.GetComponent <Interact3dItem>(); //void ActivateTeamMember() { // CharacterControlManager ccm = Global.Get<CharacterControlManager>(); // ccm.SetCharacter(memberObject); // i3i.showing = false; //} Action activateMember = () => ActivateTeamMember(memberObject); if (i3i != null) { i3i.OnInteract = activateMember; i3i.Text = "switch"; i3i.internalState.alwaysOn = true; } if (rosterUi == null) { Show.Log("missing roster UI"); return(null); } return(rosterUi.AddItem(memberObject, name, activateMember)); }