コード例 #1
0
 private void OnTriggerEnter(Collider other)
 {
     // If the thing we collided with has a SonicDetectable component, and it's within innerRadius...
     sonicDetectable = other.gameObject.GetComponent <SonicDetectable>();
     if (sonicDetectable)
     {
         sonicDetectable.OnPing(pingSource, transform.position);
     }
 }
コード例 #2
0
    private void Start()
    {
        sonicDetectable = (SonicDetectable)GetComponent(typeof(SonicDetectable));
        agent           = (NavMeshAgent)GetComponent(typeof(NavMeshAgent));
        currentHealth   = maxHealth;
        knowledgeLevel  = KnowledgeLevel.Unaware;

        agent.speed        = patrolSpeed;
        agent.angularSpeed = angularSpeed;

        keepOrbitDistanceSqr = keepOrbitDistance * keepOrbitDistance;
    }