コード例 #1
0
ファイル: PlayerSeeker.cs プロジェクト: WakeCaine/LostHope
 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
ファイル: PlayerSeeker.cs プロジェクト: WakeCaine/LostHope
    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);
        }
    }