// Use this for initialization void Awake() { landing = transform.parent.parent.GetComponent <LandingPadManager>(); fuelAnimator = GetComponentInChildren <Animator>(); Vector3 landingScale = landing.transform.localScale; Vector3 scale = transform.localScale; //Set the scale of the canvas to match the platforms scale scale.x /= landingScale.x; scale.y /= landingScale.y; transform.localScale = scale; RectTransform t = GetComponent <RectTransform> (); Vector2 canvasSize = new Vector2(Screen.width, Screen.height) * 0.5f; t.sizeDelta = canvasSize; levelManager = GameObject.FindObjectOfType <LevelManager>(); target = transform.parent; transform.position = target.position + Vector3.up * 1.5f; }
void OnEnable() { landing = transform.parent.parent.GetComponent <LandingPadManager>(); if (landing.Equals(null)) { Debug.LogError("The landingpad manager was not found in platform buttons"); } landing.enterPlatform += ShowFuel; landing.exitPlatform += HideFuel; //EventManager.StartListening(SaveStrings.eEnterPlatform, ShowFuel); //EventManager.StartListening(SaveStrings.eExitPlatform, HideFuel); }