示例#1
0
 public NPC_Alert(NPC_BehaviorAI npcStatePattern)
 {
     npc      = npcStatePattern;
     npcSight = npc.npcSight;
     npcMove  = npc.npcMove;
     npcStats = npc.npcStats;
 }
示例#2
0
    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;
            }
        }
    }
示例#3
0
 /// <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;
        }
示例#5
0
    void Start()
    {
        GetCurrentDialogueFromXML();
        hm = GetComponent <NPC_Movement>();

        if (displayOnStart)
        {
            DisplayCurrentDialogue();
            GameManager.Instance.CursorLocked = false;
        }
    }
示例#6
0
    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());
            }
        }
    }
示例#7
0
    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);*/
    }
示例#8
0
 void Start()
 {
     animator    = GetComponent <Animator>();
     npcMovement = GetComponent <NPC_Movement>();
 }
示例#9
0
 private void Start()
 {
     dialogueHandler = GetComponent <DialogueHandler>();
     hm = GetComponent <NPC_Movement>();
 }
示例#10
0
 void Start()
 {
     npc_Movement = gameObject.GetComponent <NPC_Movement>();
 }