void Awake() { isPageFinished = true; speed = defaultSpeed; animator = GetComponent <Animator>(); StartCoroutine(PlayInAnimation()); player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerMachine>(); inputManager = GameObject.FindGameObjectWithTag("InputManager").GetComponent <custom_inputs>(); }
void OnEnable() { if (optionObjects.Count > 0) { if (!keepSelectedIndex) { selectedIndex = 0; previousSelectedIndex = 0; } } else { Debug.LogWarning("A cursor without at least one valid option was enabled! Disabling!"); gameObject.SetActive(false); } PlayerMachine player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerMachine>(); audioSource = player.audioSource; inputManager = player.gameManager.inputManager; options = new List <ISelectable>(); foreach (GameObject obj in optionObjects) { ISelectable option = obj.GetComponent <ISelectable>(); options.Add(option); option.OnCursorInit(this); } targetPosition = options[selectedIndex].GetGrabPoint(); if (enableStartAnimation) { if (startPosition == Vector3.zero) { startPosition = transform.position; } transform.position = startPosition; } else { transform.position = targetPosition; } options[selectedIndex].OnCursorSelect(); active = true; }
void Start() { inputManager = GetComponent <custom_inputs>(); direction = new Vector2(); }