public void CheckForNearbyNPC() { var allParticipants = new List <NPC>(FindObjectsOfType <NPC>()); var targetNPC = allParticipants.Find(delegate(NPC p) { npcNameTalkingTo = p.characterName; npcSpeech = p.dialougeSpeech; FindObjectOfType <DialogueUI>().LoadNPCSprites(p.sprites); return(string.IsNullOrEmpty(p.talkToNode) == false && // has a conversation node? (p.transform.position - player.transform.position) // is in range? .magnitude <= player.interactionRadius); }); if (targetNPC != null) { // Kick off the dialogue at this node. FindObjectOfType <DialogueRunner>().StartDialogue(targetNPC.talkToNode); FindObjectOfType <DialogueRunner>().AddName(npcNameTalkingTo); FindObjectOfType <DialogueUI>().AddDialougeSpeech(npcSpeech); FindObjectOfType <DialogueUIBehaviour>().npcTalkingTo = targetNPC; if (targetNPC.isEnemy == true) { enemyStats = targetNPC.gameObject.GetComponent <NPCBattleStats>(); } } else { Debug.LogError("targetNPC is null"); } }
public void LoadMonstertats(NPCBattleStats _monsterStats) { currentEnemyDamageMinimum = _monsterStats.enemyDamageMinimum; currentEnemyDamageMaximum = _monsterStats.enemyDamageMaximum; currentEnemyName = _monsterStats.enemyName; currentEnemyHealth = _monsterStats.enemyHealth; currentHappyStat = _monsterStats.happyStat; currentSadStat = _monsterStats.sadStat; currentAngerStat = _monsterStats.angerStat; currentAnxiousStat = _monsterStats.anxiousStat; currentDesireStat = _monsterStats.desireStat; }