public void TriggerInteraction() { if (!CanTriggerInteraction()) { return; } switch (sequenceType) { case SequenceType.SuddenDeath: BaseDeathTrigger baseDeathTrigger = GetComponent <BaseDeathTrigger>(); baseDeathTrigger.TriggerDeath(); break; case SequenceType.SuddenDeathSkill: SkillDeathTrigger skillDeathTrigger = GetComponent <SkillDeathTrigger>(); skillDeathTrigger.TriggerDeath(); break; case SequenceType.SuddenDeathCollectable: CollectableDeathTrigger collectableDeathTrigger = GetComponent <CollectableDeathTrigger>(); collectableDeathTrigger.TriggerDeath(); break; case SequenceType.Collectable: Collectable collectable = GetComponent <Collectable>(); collectable.Collect(); break; case SequenceType.AnimationThenDeath: break; case SequenceType.ChangeScene: ChangeLevel changleLevel = GetComponent <ChangeLevel>(); changleLevel.LoadLevel(); break; case SequenceType.OpenShop: Shop.Current.OpenShop(); break; case SequenceType.CustomDeath: GetComponent <ICustomDeath>().Trigger(); break; } }
private void Update() { if (isActive) { if (Input.GetButtonDown(InputStrings.SneakButton)) { DisableVideoScreen(); return; } Vector2 pos = new Vector2(Input.GetAxis(InputStrings.HorizontalAxis), Input.GetAxis(InputStrings.VerticalAxis)) .normalized; if (pos.y > 0.3f && pos.y > Mathf.Abs(pos.x)) { Left.color = NormalColor; Right.color = NormalColor; Top.color = HighlightColor; if (Input.GetButtonDown(InputStrings.InteractButton)) { if (GameManager.Current.collectables.HasCollectable(CollectableName.ScaryMovie)) { DisableVideoScreen(); ScaryOben.TriggerDeath(); } } } else if (pos.x > 0.3f) { Left.color = NormalColor; Right.color = HighlightColor; Top.color = NormalColor; if (Input.GetButtonDown(InputStrings.InteractButton)) { if (GameManager.Current.collectables.HasCollectable(CollectableName.FunnyMovie)) { DisableVideoScreen(); FunnyRight.TriggerDeath(); } } } else if (pos.x < -0.3f) { Left.color = HighlightColor; Right.color = NormalColor; Top.color = NormalColor; if (Input.GetButtonDown(InputStrings.InteractButton)) { if (GameManager.Current.collectables.HasCollectable(CollectableName.CheesyMovie)) { DisableVideoScreen(); CheesyLeft.TriggerDeath(); } } } else { Left.color = NormalColor; Right.color = NormalColor; Top.color = NormalColor; } } }