예제 #1
0
    private void Awake()
    {
        Agent     = GetComponent <NavMeshAgent>();
        LinkMover = GetComponent <AgentLinkMover>();

        LinkMover.OnLinkStart += HandleLinkStart;
        LinkMover.OnLinkEnd   += HandleLinkEnd;
    }
예제 #2
0
    private void Awake()
    {
        Agent     = GetComponent <NavMeshAgent>();
        LinkMover = GetComponent <AgentLinkMover>();

        LinkMover.OnLinkStart += HandleLinkStart;
        LinkMover.OnLinkEnd   += HandleLinkEnd;

        LineOfSightChecker.OnGainSight += HandleGainSight;
        LineOfSightChecker.OnLoseSight += HandleLoseSight;

        OnStateChange += HandleStateChange;
    }
예제 #3
0
    private void OnTriggerStay(Collider other)
    {
        NavMeshAgent   enemyNav = other.transform.root.GetComponent <NavMeshAgent>();
        AgentLinkMover mover    = other.transform.root.GetComponent <AgentLinkMover>();

        if (enemyNav != null && enemyNav.isOnOffMeshLink && !enemyIsWalkingThru)
        {
            if (mover != null)
            {
                enemyIsWalkingThru = true;
                StartCoroutine(mover.MoveNavMesh());
            }
            else
            {
                enemyNav.CompleteOffMeshLink();
            }
        }
    }
예제 #4
0
 protected virtual void OnTriggerEnter(Collider other)
 {
     if (!isDependent)
     {
         if (other.tag == "EnemyNPC")
         {
             enemyObj       = other.gameObject;
             enemyNav       = other.GetComponent <NavMeshAgent>();
             agentLinkMover = other.GetComponent <AgentLinkMover>();
             enemyScript    = other.GetComponent <Enemy>();
         }
         else if (tag == "Player")
         {
             System.Random chance    = new System.Random();
             int           randomInt = chance.Next(0, 100);
             if (randomInt <= computerCloseChance && doorIsOpen)
             {
                 StartCoroutine(playComputerSound(computerSound));
                 Debug.Log("Moving door to closed because 079 decided to");
                 moveDoor(false);
             }
         }
     }
 }