// ------------------ void Update() { bool invokeNow = false; switch (this.eventType) { case EventType.OnPress: invokeNow = CF2Input.GetButtonDown(this.buttonName, ref this.buttonId); break; case EventType.OnRelease: invokeNow = CF2Input.GetButtonUp(this.buttonName, ref this.buttonId); break; case EventType.WhenPressed: invokeNow = CF2Input.GetButton(this.buttonName, ref this.buttonId); break; } if (invokeNow) { this.buttonEvent.Invoke(); } }
void Update() { if (CF2Input.GetButton("Click") && !LevelContainer.MenuHided) { StartCoroutine(CoroutineHideMenuAndStartGame()); } if (CF2Input.GetButton("Click") && isHammerReady && LevelContainer.GameStarted) { if (Tutorial.active) { Tutorial.SetActive(false); } if (isMovingUp) { rotationZ += data.rotationSpeed * Time.deltaTime; movingY += verticalMoveSpeed * Time.deltaTime; myTransform.rotation = Quaternion.Euler(0f, 0f, rotationZ); myTransform.position = new Vector3(myTransform.position.x, movingY, myTransform.position.z); if (myTransform.rotation.z >= 0.60f) { isMovingUp = false; } } else if (!isMovingUp) { rotationZ -= data.rotationSpeed * Time.deltaTime; movingY -= verticalMoveSpeed * Time.deltaTime; myTransform.rotation = Quaternion.Euler(0f, 0f, rotationZ); myTransform.position = new Vector3(myTransform.position.x, movingY, myTransform.position.z); if (myTransform.rotation.z <= 0f) { isMovingUp = true; } } } if (CF2Input.GetButtonUp("Click") && isHammerReady && LevelContainer.GameStarted) { SetupStrength(); ParticleSystem.Burst b = sparks.emission.GetBurst(0); b.count = strength * 20; sparks.emission.SetBurst(0, b); sparks.Play(); PlayHitSound(); SetupHammerPositionAfterHit(); isHammerReady = false; EventManager.RaiseEventHammerHit(); if (LevelContainer.GameOver) { return; } StartCoroutine(BackToPositionRoutine()); } }