public NPC_Alert(NPC_BehaviorAI npcStatePattern) { npc = npcStatePattern; npcSight = npc.npcSight; npcMove = npc.npcMove; npcStats = npc.npcStats; }
void OnTriggerEnter2D(Collider2D coll) { if (coll.CompareTag("Player")) //|| coll.CompareTag("NPC")) { if (inside == 0) { if (coroutine != null) { StopCoroutine(coroutine); } NPC_Movement nm = FindObjectOfType <NPC_Movement>(); nm.followPlayer = true; coroutine = changeTimeScale(true, Time.realtimeSinceStartup); StartCoroutine(coroutine); } inside++; if (coll.CompareTag("Player")) { coll.GetComponent <Player_Movement>().followNPC = true; } if (coll.GetComponent <NPC_Movement>() != null) { coll.GetComponent <NPC_Movement>().followPlayer = false; } } }
/// <summary> /// Creates save data for a normal guard. /// </summary> /// <param name="guardMovement"></param> public GuardSaveData(NPC_Movement guardMovement) { wasWalking = guardMovement.isWalking; walkingCounter = guardMovement.WalkingCounter; stopCounter = guardMovement.StopCounter; numSpot = guardMovement.NumSpot; guardStop = guardMovement.GuardStop; }
void SetInitialReferences() { npcSight = new NPC_Sight(this); npcMove = new NPC_Movement(this); npcStats = new NPC_Stats(); //GetComponent<NPC_Stats>(); myNavMeshAgent = GetComponent <NavMeshAgent>(); currentState = patrolState; }
void Start() { GetCurrentDialogueFromXML(); hm = GetComponent <NPC_Movement>(); if (displayOnStart) { DisplayCurrentDialogue(); GameManager.Instance.CursorLocked = false; } }
private IEnumerator OnTriggerEnter2D(Collider2D collision) { if (collision.CompareTag("Player") && !isAngry) { rigidPlayer = collision.GetComponent <Rigidbody2D>(); NPC_Movement npcObj = gameObject.GetComponent <NPC_Movement>(); if (npcObj.NPCType == NPCType.Slime) { //combat code for slime npc isAngry = true; npcObj.canMoveRandomly = false; NPCAnim.SetTrigger(npcObj.AngryAnimationName); gameObject.layer = AngryLayerInt; npcObj.IsEnabled = false; npcObj.Activity = 0; yield return(new WaitForSeconds(.001f)); npcObj.Activity = 1; yield return(new WaitForSeconds(.001f)); npcObj.Activity = 0; SpriteRenderer.sprite = AngrySprite; yield return(new WaitForSeconds(UnityEngine.Random.Range(.5f, 1f))); StartCoroutine(SearchSlime()); } if (npcObj.NPCType == NPCType.Character) { //combat code for character npc isAngry = true; npcObj.canMoveRandomly = false; NPCAnim.SetTrigger(npcObj.AngryAnimationName); gameObject.layer = AngryLayerInt; npcObj.IsEnabled = false; npcObj.Activity = 0; yield return(new WaitForSeconds(.001f)); npcObj.Activity = 1; yield return(new WaitForSeconds(.001f)); npcObj.Activity = 0; SpriteRenderer.sprite = AngrySprite; yield return(new WaitForSeconds(UnityEngine.Random.Range(.5f, 1f))); StartCoroutine(SearchCharacter()); } } }
void Start() { GetCurrentDialogueFromXML(); hm = GetComponent <NPC_Movement>(); //DisplayCurrentDialogue(); // Test Code /*List<DialogueOption> options = new List<DialogueOption>(); * * DialogueEntry next = new DialogueEntry(this, "It worked! (That's a miracle!)", null); * * options.Add(new DialogueOption(this, "Test Option 1", null, next, null, true)); * * _currentDialogue = new DialogueEntry(this, "This is test dialogue.", options);*/ }
void Start() { animator = GetComponent <Animator>(); npcMovement = GetComponent <NPC_Movement>(); }
private void Start() { dialogueHandler = GetComponent <DialogueHandler>(); hm = GetComponent <NPC_Movement>(); }
void Start() { npc_Movement = gameObject.GetComponent <NPC_Movement>(); }