public void AddMission() { if (Mission_in_activate.Missions.Exists(x => x == NowMissionNumber)) { Debug.LogWarning("This Mission has already added."); return; } Debug.Log(LoadedMissions.Missions[NowMissionNumber - 1].NPCName); NPCcontroller NPC = GameObject.Find(LoadedMissions.Missions[NowMissionNumber - 1].NPCName).GetComponent <NPCcontroller>(); NPC.MissionAccept(); Mission_in_activate.Missions.Add(NowMissionNumber); return; }
// Start is called before the first frame update void Start() { mover = GetComponent <Mover>(); controller = GetComponent <NPCcontroller>(); health = GetComponent <Health>(); if (attackerScript == null) { attackerScript = GetComponent <Attacker>(); } if (abilityCaster == null) { abilityCaster = GetComponent <AbilityCaster>(); } }
void OnTriggerEnter(Collider col) { //checks for the Interactable tag on the the object who's collider we just entered if (col.tag == "Interactable") { //Stores the interactable that has been entered as a new Interactable instance Interactable interactable = col.GetComponent <Interactable>(); ItemPickup itemPickup = col.GetComponent <ItemPickup>(); //Debug.Log ("This object is: " + col.gameObject.name); //used to set the transfrom Vector3 of the target collider //target = col.transform.position; itemName.text = itemPickup.item.name; itemDescription.text = itemPickup.item.description; //If we have hit an interactable, set it as the focus of the player if (interactable != null) { //brings up the interact panel UI interactPanelUI.SetActive(true); SetFocus(interactable); //FaceTarget (); } } //checks for the NPC tag on the the object who's collider we just entered if (col.tag == "NPC") { //Stores the NPC that has been entered as a new Interactable instance Interactable interactable = col.GetComponent <Interactable>(); NPCcontroller npcController = col.GetComponent <NPCcontroller>(); itemName.text = npcController.npc.npcName; itemDescription.text = npcController.npc.description; //If we have hit an interactable, set it as the focus of the player if (interactable != null) { //brings up the interact panel UI interactPanelUI.SetActive(true); SetFocus(interactable); //FaceTarget (); } } }