コード例 #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);
             }
         }
     }
 }