Advertisement
johnnygoodguy2000

LadderZone.cs

May 15th, 2024
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.76 KB | Gaming | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class LadderZone : MonoBehaviour
  6. {
  7.  
  8.     private PlayerController thePlayer;
  9.     // Start is called before the first frame update
  10.     void Start()
  11.     {
  12.         thePlayer = FindObjectOfType<PlayerController>();//Get player with player controller script attached
  13.     }
  14.  
  15.     void OnTriggerEnter2D(Collider2D other)
  16.     {
  17.         if (other.name == "Player")
  18.         {
  19.             thePlayer.onLadder = true;
  20.         }
  21.     }
  22.  
  23.     void OnTriggerExit2D(Collider2D other)
  24.     {
  25.         if (other.name == "Player")
  26.         {
  27.             thePlayer.onLadder = false;
  28.         }
  29.     }
  30.  
  31.     /*// Update is called once per frame
  32.     void Update()
  33.     {
  34.        
  35.     }*/
  36. }
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement