Moving to flex, Hoping it would fix platform
This commit is contained in:
46
Assets/Scripts/Door.cs
Normal file
46
Assets/Scripts/Door.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Door : MonoBehaviour
|
||||
{
|
||||
public SpriteRenderer openDoorSprite;
|
||||
public bool locked;
|
||||
|
||||
void Start(){
|
||||
if(!locked){
|
||||
openDoorSprite.color = Color.black;
|
||||
}
|
||||
}
|
||||
|
||||
public void unlock(){
|
||||
locked=false;
|
||||
openDoorSprite.color = Color.black;
|
||||
}
|
||||
|
||||
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void OnTriggerEnter2D(Collider2D col){
|
||||
Debug.Log(col.gameObject.name + " Entered");
|
||||
NetPlayer playerObject = col.GetComponent<NetPlayer>();
|
||||
if(!locked&& playerObject!=null){
|
||||
if(playerObject.isLocalPlayer){
|
||||
col.GetComponent<PlayerController>().inDoor = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OnTriggerExit2D(Collider2D col){
|
||||
Debug.Log(col.gameObject.name + " Exited");
|
||||
NetPlayer playerObject = col.GetComponent<NetPlayer>();
|
||||
if(!locked&& playerObject!=null){
|
||||
if(playerObject.isLocalPlayer){
|
||||
col.GetComponent<PlayerController>().inDoor = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user