private void UpdateDunkReadyPanel() { if (CanDunk() && currentDunkReadyPanel != null) { if (!currentDunkReadyPanel.activeSelf) { if (enableDunkReadyPanel) { currentDunkReadyPanel.SetActive(true); } } if (currentDunkReadyFX == null) { currentDunkReadyFX = FeedbackManager.SendFeedback("event.DunkReady", this, pawnController.GetCenterPosition(), Vector3.up, Vector3.up, !isPlayer).GetVFX(); } currentDunkReadyPanel.transform.position = GameManager.mainCamera.WorldToScreenPoint(pawnController.GetHeadPosition()); } else { if (currentDunkReadyFX != null) { Destroy(currentDunkReadyFX); } if (currentDunkReadyPanel.activeSelf) { currentDunkReadyPanel.SetActive(false); } } }
private void AttractEnemies() { if (pawnController == null) { return; } GameObject attractionFX = FeedbackManager.SendFeedback("event.DunkAttraction", this, transform.position, Vector3.up, Vector3.up, !isPlayer).GetVFX(); attractionFX.transform.localScale = Vector3.one * dunkAspirationRadius; List <EnemyBehaviour> pushedEnemies = new List <EnemyBehaviour>(); foreach (Collider c in Physics.OverlapSphere(transform.position, dunkAspirationRadius)) { if (c.gameObject.layer == LayerMask.NameToLayer("Enemy")) { EnemyBehaviour enemy = c.GetComponentInParent <EnemyBehaviour>(); if (enemy != null && !pushedEnemies.Contains(enemy)) { Vector3 pushDirectionFlat = transform.position - enemy.transform.position; pushDirectionFlat.y = 0; float pushDistance = Vector3.Distance(transform.position, c.gameObject.transform.position) - aspirationMinDistanceToPlayer; pushDistance = Mathf.Clamp(pushDistance, 0, Mathf.Infinity); enemy.PushLightCustom(pushDirectionFlat, pushDistance, 0.5f, 0f); pushedEnemies.Add(enemy); } } } }
void FixedUpdate() { for (int i = 0; i < pawnTrapped.Count; i++) { PawnController item = pawnTrapped[i]; if (item.GetHealth() < 1) { pawnTrapped.Remove(item); } } waitTimeBeforeNextDamage -= Time.deltaTime; if (waitTimeBeforeNextDamage < 0 && !isActivated && !shutDown) { waitTimeBeforeNextDamage = puzzleData.timeCheckingDamageEletricPlate; foreach (PawnController item in pawnTrapped) { if (item.GetComponent <EnemyBehaviour>()) { item.Damage(puzzleData.DamageEletricPlateEnnemies); } else { item.Damage(puzzleData.DamageEletricPlate); } Analytics.CustomEvent("ElectricalPlateDamage", new Dictionary <string, object> { { "Zone", GameManager.GetCurrentZoneName() }, }); item.AddSpeedModifier(new SpeedCoef(speedModifier, puzzleData.timeCheckingDamageEletricPlate, SpeedMultiplierReason.Freeze, false)); FeedbackManager.SendFeedback("event.PuzzleElectricPlateDamage", item); } } }
public void DisplayHealth(HealthAnimationType _type = HealthAnimationType.Gain) { switch (_type) { case HealthAnimationType.Gain: if (displayedPanels.Contains(healthPanel)) { HideHealthBar(); StopCoroutine(currentCoroutines[healthPanel]); currentCoroutines[healthPanel] = StartCoroutine(UpdatePanel_C(healthPanel, healthGainShowDuration, healthGainFadeOutSpeed, healthGainEndScale, ShowHealthBar)); } else if (!currentCoroutines.ContainsKey(healthPanel)) { HideHealthBar(); currentCoroutines.Add(healthPanel, StartCoroutine(DisplayPanel_C(healthPanel, healthGainShowDuration, healthGainFadeInSpeed, healthGainFadeOutSpeed, healthGainStartScale, healthGainEndScale, healthGainAnimationCurve, ShowHealthBar))); } break; case HealthAnimationType.Loss: FeedbackManager.SendFeedback("event.PlayerHealthDecreasing", healthPanel); if (displayedPanels.Contains(healthPanel)) { HideHealthBar(); StopCoroutine(currentCoroutines[healthPanel]); currentCoroutines[healthPanel] = StartCoroutine(UpdatePanel_C(healthPanel, healthLossShowDuration, healthLossFadeOutSpeed, healthLossEndScale, ShowHealthBar)); } else if (!currentCoroutines.ContainsKey(healthPanel)) { HideHealthBar(); currentCoroutines.Add(healthPanel, StartCoroutine(DisplayPanel_C(healthPanel, healthLossShowDuration, healthLossFadeInSpeed, healthLossFadeOutSpeed, healthLossStartScale, healthLossEndScale, healthLossAnimationCurve, ShowHealthBar))); } break; } }
public void DestroyTheObject() { destroyed = true; FeedbackManager.SendFeedback("event.DestrObjectDeath", this, transform.position, transform.up, transform.up); visualsToHideWhenDestroyed.SetActive(false); destroyedVisuals.SetActive(true); }
public virtual void DeactivatedAction() { ActivateLinkedObjects(); isActivated = true; UpdateLight(); FeedbackManager.SendFeedback("event.PuzzleRepeaterDesactivation", this); }
IEnumerator ExtendArm_C() { if (animator == null) { Debug.Log("Animator null"); } animator.SetTrigger("GrappleLaunchTrigger"); Vector3 directionSet = previewLineRenderer.transform.forward; grabHand.gameObject.SetActive(true); FeedbackManager.SendFeedback("event.GrabExtensionStart", grabHand); grabHand.transform.SetParent(null, true); grabHand.transform.localScale = Vector3.one; Vector3 startPosition = grabHand.transform.position; Vector3 hitPosition = startPosition + directionSet.normalized * maxRange; RaycastHit hit; if (Physics.Raycast(grabHand.transform.position, directionSet, out hit, maxRange, LayerMask.GetMask("Environment"), QueryTriggerInteraction.Ignore)) { hitPosition = hit.point; grabbedObject = hit.collider.transform; } float totalDistance = Vector3.Distance(startPosition, hitPosition); for (float i = 0; i < totalDistance; i += Time.deltaTime * grabExtentionSpeed) { grabHand.transform.position = Vector3.Lerp(startPosition, hitPosition, extensionSpeedCurve.Evaluate(i / totalDistance)); yield return(null); } grabHand.transform.forward = hit.normal; CheckWhatGotGrabbed(); }
// Update is called once per frame void Update() { if (explosionInitiated) { waitingForExplosion -= Time.deltaTime; if (!Explosed) { innerCircleTransform.localScale = Vector3.Lerp(Vector3.zero, Vector3.one * targetScale, (waitTimeForExplosion - waitingForExplosion) / waitTimeForExplosion); } if (waitingForExplosion < 0 && !Explosed) { Explosed = true; GameObject FX = FeedbackManager.SendFeedback("event.IndianaRegularExposion", this).GetVFX(); FX.transform.localScale = new Vector3(myScale, myScale, myScale); foreach (var item in listPawnsHere) { item.Damage(15); item.Push(PushType.Light, item.transform.position - transform.position, PushForce.Force2); } } if (waitingForExplosion < -0.45f) { Destroy(gameObject); } } }
public virtual void Heal(int _amount) { float i_newHealth = currentHealth + _amount; currentHealth = Mathf.Clamp(i_newHealth, 0, GetMaxHealth()); FeedbackManager.SendFeedback(eventOnHealing, this); }
public void IncreaseCounter(int _amount) { if (counterEnd) { return; } for (int i = 0; i < _amount; i++) { currentActivatedIndex += 1; if (currentActivatedIndex >= counterList.Count) { return; } SetCounterToGreen(counterList[currentActivatedIndex]); if (currentActivatedIndex >= counterList.Count - 1) { currentActivatedIndex = 0; SetCounterToGreen(counterList[currentActivatedIndex]); } if (isWaveCounter) { FeedbackManager.SendFeedback("event.WaveCounterIncreasing", this); } if (currentActivatedIndex == 0) { FeedbackManager.SendFeedback("event.WaveCounterFinished", this); SetCounterToGreen(counterList[0]); counterEnd = true; } } }
} //Indicate that the player can now revive someone public void Revive(PlayerController _player) { Analytics.CustomEvent("PlayerRevive", new Dictionary <string, object> { { "Zone", GameManager.GetCurrentZoneName() }, }); FeedbackManager.SendFeedback(eventOnResurrecting, this); moveState = MoveState.Idle; _player.moveState = MoveState.Idle; _player.animator.SetTrigger("Revive"); _player.SetTargetable(); _player.UnHide(); _player.currentHealth = GetMaxHealth(); _player.transform.position = transform.position + Vector3.up * 7 + Vector3.left * 0.1f; _player.FreezeTemporarly(reviveFreezeDuration); _player.EnableInput(); StartCoroutine(DisableInputsTemporarly_C(reviveFreezeDuration * 2)); FreezeTemporarly(reviveFreezeDuration); SetTargetable(); List <ReviveInformations> i_newRevivablePlayers = new List <ReviveInformations>(); StartCoroutine(ProjectEnemiesInRadiusAfterDelay_C(0.4f, reviveExplosionRadius, reviveExplosionDamage, DamageSource.ReviveExplosion)); foreach (ReviveInformations inf in revivablePlayers) { if (inf.linkedPlayer != _player) { i_newRevivablePlayers.Add(inf); } } revivablePlayers = i_newRevivablePlayers; GameManager.deadPlayers.Remove(_player); GameManager.alivePlayers.Add(_player); canBeKilled = true; }
public void OnHit(BallBehaviour _ball, Vector3 _impactVector, PawnController _thrower, float _damages, DamageSource _source, Vector3 _bumpModificators = default) { if (destroyed) { return; } FeedbackManager.SendFeedback("event.BossLegHit", this); legAnimator.StartCoroutine(legAnimator.BumpLeg_C()); if (_source == DamageSource.PerfectReceptionExplosion) { _damages = _damages * perfectReceptionDamageMultiplier; } if (destroyable) { currentHP -= _damages; currentHP = Mathf.Clamp(currentHP, 0f, maxHP); if (currentHP <= 0) { Dismantle(); } } else { boss.Damage(_damages); } }
void SelectPreviousButton() { FeedbackManager.SendFeedback("event.MenuUpAndDown", this); selectedButtonIndex--; selectedButtonIndex = Mathf.Clamp(selectedButtonIndex, 0, buttons.Count - 1); SelectButton(buttons[selectedButtonIndex]); }
public void GoToSettings() { FeedbackManager.SendFeedback("event.PressSettings", this); optionMenuCanvas.enabled = true; optionMenu.GetComponent <SettingsMenu>().CheckListWhenLaunchingSettings(); isMainMenuActive = false; }
public void OnHit(BallBehaviour _ball, Vector3 _impactVector, PawnController _thrower, float _damages, DamageSource _source, Vector3 _bumpModificators = default(Vector3)) { //Stop the ball if (_ball != null) { Analytics.CustomEvent("BallStopped", new Dictionary <string, object> { { "Zone", GameManager.GetCurrentZoneName() }, }); _ball.ChangeSpeed(0); fX_StopBall = FeedbackManager.SendFeedback("event.PuzzleBlockBall", this, _ball.transform.position, -_impactVector, _impactVector).GetVFX(); } //Show an FX if (fX_StopBall != null) { Destroy(fX_StopBall); } //Will desactivate all puzzle links PuzzleLink[] i_links = FindObjectsOfType <PuzzleLink>(); foreach (var item in i_links) { item.chargingTime = -1f; } }
private void ChangeLinkState(LinkState _newState) { if (linkState == _newState) { return; } switch (_newState) { case LinkState.Broken: FeedbackManager.SendFeedback("event.LinkBroken", firstPawn, firstPawn.GetCenterPosition(), firstPawn.GetCenterPosition() - transform.position, firstPawn.GetCenterPosition() - transform.position); FeedbackManager.SendFeedback("event.LinkBroken", secondPawn, secondPawn.GetCenterPosition(), secondPawn.GetCenterPosition() - transform.position, secondPawn.GetCenterPosition() - transform.position); WarningPanel.OpenPanel(); break; case LinkState.Rebuilt: FeedbackManager.SendFeedback("event.LinkRebuilt", firstPawn, firstPawn.GetCenterPosition(), firstPawn.GetCenterPosition() - transform.position, firstPawn.GetCenterPosition() - transform.position); FeedbackManager.SendFeedback("event.LinkRebuilt", secondPawn, secondPawn.GetCenterPosition(), secondPawn.GetCenterPosition() - transform.position, secondPawn.GetCenterPosition() - transform.position); WarningPanel.ClosePanel(); break; case LinkState.Showing: break; case LinkState.Slowing: break; case LinkState.Hidden: break; } linkState = _newState; }
override public void Activate() { isActivated = true; UpdateLights(); life--; if (life > -1) { if (life == 0) { FeedbackManager.SendFeedback("event.WeakPointDestroyed", this); //FXManager.InstantiateFX(explosionFx, transform.position, true, Vector3.zero, Vector3.one * 5); mainTurret.InverseLaser(); //DestroyWeakPoint(); StartCoroutine(FillIndicator()); OldBoss_Manager.i.DestroyAWeakPoint(); foreach (var item in puzzleActivators) { item.ShutDownPuzzleActivator(); } } else { PuzzleLink[] links = FindObjectsOfType <PuzzleLink>(); foreach (var item in links) { item.chargingTime = -1f; } } } }
IEnumerator TeaBag_C() { bool animationTriggered = false; for (float i = 0; i < previewDuration; i += Time.deltaTime) { innerCircle.transform.localScale = Vector3.Lerp(Vector3.zero, Vector3.one, i / previewDuration); if (i >= previewDuration - 0.4f && !animationTriggered) //0.4f is the length of the animation before hiting the ground { animationTriggered = true; linkedBoss.animator.SetTrigger("Teabag"); } yield return(null); } FeedbackManager.SendFeedback("event.BossTeabag", this.gameObject); foreach (PlayerController p in GameManager.alivePlayers) { float playerDistance = Vector3.Distance(p.transform.position, transform.position); if (playerDistance <= damageRange) { p.Damage(damages); } if (playerDistance <= pushRange) { Vector3 pushDirection = Vector3.Normalize(p.transform.position - transform.position); pushDirection.y = 0.1f; p.Push(PushType.Heavy, pushDirection, PushForce.Force2); } } Destroy(this.gameObject); }
private void OnTriggerExit(Collider _other) { PawnController foundPawn = _other.gameObject.GetComponent <PawnController>(); if (foundPawn) { if (pawnHereList.Contains(foundPawn)) { pawnHereList.Remove(foundPawn); if (pawnHereList.Count < 1) { if (isActivated) { FeedbackManager.SendFeedback("event.PuzzlePressurePlateDesactivation", this); } isActivated = false; animator.SetBool("Activated", false); DesactiveLinkedObjects(); pawnHere = false; transform.localScale = new Vector3(transform.localScale.x, 1f, transform.localScale.z); } } } //UpdateLight(); }
public IEnumerator MoveLeg_C() { isGrounded = false; for (float i = 0; i < 1; i += Time.deltaTime * (legSpeed * Random.Range(0.8f, 1.2f))) { if (wantedTransform != null && IK.Target != null && IK.Target.transform != null) { Vector3 newPosition = Vector3.Lerp(IK.Target.transform.position, wantedTransform.transform.position + forwardOffset, i / 1f); float yPos = Mathf.Lerp(IK.Target.transform.position.y, wantedTransform.transform.position.y, i / 1f); yPos += heightCurve.Evaluate(i / 1f) * height; newPosition.y = yPos; IK.Target.transform.position = newPosition; yield return(null); } } IK.Target.transform.position = wantedTransform.transform.position + forwardOffset; isGrounded = true; if (eventOnStep != "") { FeedbackManager.SendFeedback(eventOnStep, this); } if (bumpPawnsOnGrounded) { List <PawnController> hitPawns = new List <PawnController>(); foreach (Collider c in Physics.OverlapSphere(IK.Target.transform.position, bumpPawnRadius)) { PawnController pawnController = c.GetComponentInParent <PawnController>(); if (pawnController != null && !hitPawns.Contains(pawnController)) { pawnController.Push(PushType.Light, pawnController.transform.position - IK.Target.transform.position, PushForce.Force1); hitPawns.Add(pawnController); } } } }
public void PlayFootstepSound(AnimationEvent _evt) { if (_evt.animatorClipInfo.weight > 0.5) { FeedbackManager.SendFeedback("event.PlayerWalkingOnGround", linkedPlayer); } }
public void ActivateHammerAttackHitBox() { if (bossState == BossState.HammerPunchAttack) { FeedbackManager.SendFeedback("event.BossPunchAttack", this); } HammerAttack_attackHitBoxInstance = Instantiate(HammerAttack_attackHitBoxPrefab, transform.position + PunchAttack_hitBoxOffset.x * transform.right + PunchAttack_hitBoxOffset.y * transform.up + PunchAttack_hitBoxOffset.z * transform.forward, transform.rotation, transform); }
IEnumerator OpenAfterDelay_C() { yield return(new WaitForSeconds(delayBeforeOpening)); animator.SetBool("Opened", true); linkedCollider.isTrigger = true; FeedbackManager.SendFeedback("event.ArenaDoorOpening", this); }
public void OnArenaEnter() { if (closeOnArenaStart) { animator.SetBool("Opened", false); FeedbackManager.SendFeedback("event.ArenaDoorClosing", this); } }
public void DestroyTheObject() { Analytics.CustomEvent("ObjectDestroyed", new Dictionary <string, object> { { "Zone", GameManager.GetCurrentZoneName() }, }); FeedbackManager.SendFeedback(deathEvent, this, transform.position, transform.up, transform.up); Destroy(gameObject); }
public void CloseLevelSelector() { FeedbackManager.SendFeedback("event.PressExit", this); sceneList.gameObject.SetActive(false); buttons = menuButtons; SelectButton(buttons[0]); Time.timeScale = 1; }
public void ActivateAttackHitBox() { FeedbackManager.SendFeedback("event.EnemyMeleeAttack", this); if (attackHitBoxInstance != null) { attackHitBoxInstance.GetComponent <EnemyArmAttack>().ToggleArmCollider(true); } }
private IEnumerator ExplosionSequence_C(bool _isSafeExplosion) { Debug.Log("Starting explosion sequence"); animator.SetTrigger("DeathTrigger"); if (_isSafeExplosion) { FeedbackManager.SendFeedback(buildUpSafeExplosionFX, this); } else { FeedbackManager.SendFeedback(buildUpExplosionFX, this); } willExplode = true; //hitParticle.transform.localScale = 3f; explosionRadiusTransform.gameObject.SetActive(true); float i_time = 0; while (i_time < 1 && willExplode) { explosionGrowingRenderer.localScale = Vector3.Lerp(Vector3.zero, Vector3.one, i_time); i_time += Time.deltaTime / buildUpBeforeExplosion; //Color flicker on death if (Random.Range(0f, 1f) > 0.5f) { bodyRenderer.material.SetColor("_EmissionColor", emissionColor * minMaxEmissionOnDeath.x); } else { bodyRenderer.material.SetColor("_EmissionColor", emissionColor * minMaxEmissionOnDeath.y); } yield return(null); } if (!willExplode) { explosionRadiusTransform.gameObject.SetActive(false); explosionGrowingRenderer.localScale = Vector3.zero; Explosion_C = null; yield break; } else { if (_isSafeExplosion) { SafeExplode(); } else { Explode(); } Kill(); } }
IEnumerator Dash_C(Vector3 _startPosition, Vector3 _endPosition) { currentUseCooldown = useCooldown; currentStackAmount--; currentDashFX = FeedbackManager.SendFeedback("event.Dash", this).GetVFX(); Vector3 i_dashDirection = _endPosition - _startPosition; ChangeState(DashState.Dashing); float i_cloneCounter = 0; for (float i = 0; i <= duration; i += Time.deltaTime) { i_cloneCounter += Time.deltaTime; if (i_cloneCounter >= 1f / clonePerSec) { GenerateClone(); i_cloneCounter = 0; } RaycastHit[] hits = Physics.SphereCastAll(linkedPawn.GetCenterPosition(), dashHitboxSize, i_dashDirection.normalized, 0.4f); foreach (RaycastHit hit in hits) { PlayerController hitPawn = hit.collider.transform.gameObject.GetComponent <PlayerController>(); if (hitPawn) { if (hitPawn != linkedPawn) { DashController dashController = hitPawn.GetComponent <DashController>(); if (dashController != null) { dashController.StopAllCoroutines(); dashController.ChangeState(DashState.None); linkedPawn.Push(PushType.Light, -i_dashDirection, PushForce.Force2); } hitPawn.Push(PushType.Light, i_dashDirection, PushForce.Force2); if (!unstoppableDash) { ChangeState(DashState.None); StopAllCoroutines(); } } } if (hit.transform.gameObject.layer == LayerMask.NameToLayer("Environment")) { StartCoroutine(StopDash_C()); } } transform.position = Vector3.Lerp(_startPosition, _endPosition, dashSpeedCurve.Evaluate(i / duration)); yield return(null); } transform.position = _endPosition; GenerateClone(); ChangeState(DashState.None); StartCoroutine(FadePlayerSpeed()); yield return(null); }
void SelectPreviousSettings() { FeedbackManager.SendFeedback("event.MenuUpAndDown", this); if (selectedSettingIndex - 1 >= 0) { selectedSettingIndex--; selectedSetting = settingsParentScript.SelectSetting(selectedSettingIndex); SetDescriptionTexts(selectedSetting); } }