public void LoadMainMenu() { // Destroy HealthStatus and Player Destroy(this.gameObject); TorchController.ResetTorches(); TutorialTextFadeController.alreadyFaded = false; SceneManager.LoadScene("MainMenuScene"); }
public override void OnExecute(TriggerAction.TYPE action) { base.OnExecute(action); if (action == TriggerAction.TYPE.Ignite) { TorchController.Get().OnDynamiteIgnite(this); } }
private void GetReferences() { _pMovement = GetComponent <PlayerMovement>(); _camScript = GetComponentInChildren <CamMouseLook>(); _interactRay = GetComponent <InteractRay>(); _torchController = _camScript.GetComponentInChildren <TorchController>(); _inventory = GetComponent <Inventory>(); }
void Start() { cam = Camera.main; bagPickup = false; locket = false; printText = canvas.GetComponent <TextControl>(); audioSource = this.gameObject.GetComponent <AudioSource>(); torch = this.gameObject.GetComponent <TorchController>(); }
private void Firing() { if (!fired) { if (InputManager.Fire()) { torch.SetActive(false); flyingTorch = Instantiate(flyingTorchPrefab, torch.transform.position, torch.transform.rotation); torchController = flyingTorch.GetComponent <TorchController>(); torchController.direction = lightDirection; fired = true; } } }
protected override void Attack() { if (!this.CanAttack()) { if (!this.m_ComboBlocked && !PlayerConditionModule.Get().IsLowStamina()) { AnimatorStateInfo currentAnimatorStateInfo = this.m_Animator.GetCurrentAnimatorStateInfo(1); if ((currentAnimatorStateInfo.shortNameHash == this.m_NMeleeAttackRightSwing && currentAnimatorStateInfo.normalizedTime > 0.2f) || currentAnimatorStateInfo.shortNameHash == this.m_ReleaseStateRight1 || (currentAnimatorStateInfo.shortNameHash == this.m_NMeleeAttackRightReturn && currentAnimatorStateInfo.normalizedTime < 0.5f)) { this.m_ReleaseComboScheduled = true; } if (currentAnimatorStateInfo.shortNameHash == this.m_NMeleeAttackRightSwing && currentAnimatorStateInfo.normalizedTime > 0.5f && currentAnimatorStateInfo.normalizedTime < 1f && !this.m_Animator.GetBool(this.m_BAttackLeft)) { this.m_ComboScheduled = true; return; } if (currentAnimatorStateInfo.shortNameHash == this.m_ReleaseStateRight1) { this.m_ComboScheduled = true; return; } if (currentAnimatorStateInfo.shortNameHash == this.m_NMeleeAttackLeftSwing && currentAnimatorStateInfo.normalizedTime > 0.5f && currentAnimatorStateInfo.normalizedTime < 1f && !this.m_Animator.GetBool(this.m_BAttackRight)) { this.m_ComboScheduled = true; return; } if (this.m_Animator.GetBool(this.m_BAttackRightRelease)) { this.m_Animator.SetBool(this.m_BAttackRight, true); this.m_ComboScheduled = true; } } return; } if (!this.IsAttack()) { base.Attack(); bool flag = false; if (!TorchController.Get().IsActive() && (this.m_Player.GetFPPController().IsDuck() || this.m_Player.GetLookController().m_LookDev.y < -40f)) { flag = true; } if (flag) { this.m_Animator.SetBool(this.m_BAttackUp, true); this.m_AttackDirection = AttackDirection.Up; } else { this.m_Animator.SetBool(this.m_BAttackRight, true); this.m_AttackDirection = AttackDirection.Right; } } this.m_Animator.SetBool(this.m_BAttackRightRelease, false); this.m_Animator.SetBool(this.m_BAttackLeftRelease, false); this.m_Animator.SetBool(this.m_BAttackUpRelease, false); this.m_LastAttackTime = Time.time; this.m_ComboScheduled = false; this.m_ComboBlocked = false; this.m_ReleaseComboScheduled = false; this.m_ReleaseCombo = false; this.m_HitObjects.Clear(); }
private void UpdateInteractiveInput() { if (!InteractButtonPressed()) { return; } var interactElement = GameController.instance.activeInteractiveElement as MonoBehaviour; if (interactElement != null) { if (GameController.instance.activeInteractiveElement as TreeController != null) { if (!_charAnimator.isChopping) { // Cut the tree only if character ended chopping animation GameController.instance.activeInteractiveElement.Interact(); _charAnimator.ChopAnimation(); } } else { GameController.instance.activeInteractiveElement.Interact(); if (_characterHands.currentlyHolding == Holdable.Wood || _characterHands.currentlyHolding == Holdable.Torch) { if (_carriedTorch != null) { Destroy(_carriedTorch.gameObject); } _characterHands.AddWoodToFire(); return; } if (!interactElement.CompareTag("Fire")) { return; } var torchFuel = _characterHands.PickTorch(); _carriedTorch = TorchController.Craft(_torchPrefab, _transform, torchFuel); return; } } if (_carriedTorch == null) { return; } _carriedTorch.Place(_transform.position + _transform.forward); _carriedTorch.transform.parent = null; _carriedTorch.gameObject.SetActive(true); _carriedTorch = null; _characterHands.SetHolding(Holdable.Nothing); }