コード例 #1
0
ファイル: DoorTrigger.cs プロジェクト: polgafr/Unity
    void OnTriggerEnter2D(Collider2D other)
    {
        if (ignoreTrigger)
        {
            return;
        }

        if (other.tag == "Player")
        {
            door.DoorOpens();
        }
    }
コード例 #2
0
    //when an object collides with the object
    void OnTriggerEnter2D(Collider2D other)
    {
        //if the ignorTrigger is set true, exit
        if (ignoreTrigger)
        {
            return;
        }

        //if the object has the tag "Player" open the door
        if (other.tag == "Player")
        {
            door.DoorOpens();
        }
    }
コード例 #3
0
ファイル: DoorTrigger.cs プロジェクト: guipsg/RunAfterHim
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag == "Player" || other.tag == "Ball")
     {
         door.DoorOpens();
         an.SetBool("isOn", true);
         Instantiate(particle, transform.position, particle.transform.rotation);
     }
 }
コード例 #4
0
 public void Toggle(bool state)
 {
     if (state)
     {
         door.DoorOpens();
     }
     else
     {
         door.DoorCloses();
     }
 }