예제 #1
0
 private void OnTriggerEnter(Collider other)
 {
     myV = this.gameObject.transform.position;
     if (other.tag == "Hero_Ambient")
     {
         if (!following && !targetLastV.Equals(targetV))
         {
             visible     = true;
             targetLastV = targetV;
             following   = true;
             PathRequest_Manager.RequestPath(transform.position, targetV, OnPathFound);
         }
     }
     else if (other.tag == "Light_Trigger")
     {
         if (!following && !targetLastV.Equals(targetV))
         {
             visible     = true;
             targetLastV = targetV;
             following   = true;
             PathRequest_Manager.RequestPath(transform.position, targetV, OnPathFound);
         }
     }
     else if (other.tag == "PlayerBody")
     {
         hero.PlayerDead();
     }
 }
예제 #2
0
    void FixedUpdate()
    {
        if (visible)
        {
            GetComponent <SpriteRenderer> ().enabled = true;
        }
        else if (!visible)
        {
            GetComponent <SpriteRenderer> ().enabled = false;
        }
        visible = false;

        if (seekTime == 0)
        {
            StartCoroutine(Seek());
        }

        if (seekTime > 3)
        {
            PathRequest_Manager.RequestPath(transform.position, myV, OnPathFound);
        }
    }