public void Awake() { m_Rotation = transform.localEulerAngles; m_FollowCamera = Camera.main.GetComponent <NavMeshAgent>(); m_LevelTokens = new ArrayList(); m_TotalNumLevelTokens = 0; foreach (CollectableObject co in FindObjectsOfType <CollectableObject>()) { if (co.IsLevelToken) { m_TotalNumLevelTokens++; } } m_IsGameOver = false; m_Controls = new PaddleControls(); m_Controls.gameplay.fire.performed += ctx => { if ((gameLevelManager.State == GameLevelManager.GameState.Playing) && (GameCoordinator.Instance.Health > 0)) { // if (ctx.interaction is SlowTapInteraction) // { // StartCoroutine(BurstFire(1 + (int) (ctx.duration * burstFireSpeed))); // } // else { Fire(); } } m_FireCharging = false; }; m_Controls.gameplay.fire.started += ctx => { if (GameCoordinator.Instance.Health > 0) { if (ctx.interaction is SlowTapInteraction) { m_FireCharging = true; } } }; m_Controls.gameplay.fire.canceled += ctx => { //Debug.Log($"Fire cancelled"); m_FireCharging = false; }; m_Controls.gameplay.jump.performed += ctx => { //Debug.Log($"Jump {ctx.interaction.ToString()} performed for {ctx.duration}"); if ((gameLevelManager.State == GameLevelManager.GameState.Playing) && (GameCoordinator.Instance.Health > 0) && m_Grounded) { if (ctx.interaction is MultiTapInteraction multiTap) { Jump(1 + (int)(multiTap.tapCount * jumpPreload)); } else if (ctx.interaction is SlowTapInteraction) { Jump(1 + (int)(ctx.duration * jumpPreload)); } else { Jump(1); } } m_JumpPreloading = false; }; m_Controls.gameplay.jump.started += ctx => { if (GameCoordinator.Instance.Health > 0) { if (ctx.interaction is SlowTapInteraction) { m_JumpPreloading = true; } } }; m_Controls.gameplay.jump.canceled += ctx => { //Debug.Log($"Jump cancelled"); m_JumpPreloading = false; }; }
// Use this for initialization void Start() { paddle = FindObjectOfType <PaddleControls>(); }