// Use this for initialization void Start() { instance = this; if (transitionName == PlayerController.instance.areaTransitionName) { PlayerController.instance.transform.position = transform.position; } UIFade.instance.FadeFromBlack(); GameManager.instance.fadingBetweenAreas = false; }
public static PlayerController INSTANCE; // this doesn't show up in the UI because it is static private void Start() { Rigidbody2D rb = GetComponentInParent <Rigidbody2D>(); AreaEntrance entrance = FindObjectOfType <AreaEntrance>(); rb.constraints = allowZRotation ? RigidbodyConstraints2D.None : RigidbodyConstraints2D.FreezeRotation; // Only instantiate when the game starts running if (INSTANCE == null) { INSTANCE = this; } else { Destroy(gameObject); } if (entrance != null) { this.goThroughDoor(entrance.transform.position); } DontDestroyOnLoad(gameObject); }
public void SetAreaTransitionName() { theEntrance = GetComponentInChildren <AreaEntrance>(); theEntrance.transitionName = areaTransitionName; }