void Update() { AnimatedTvariable(); if (searching) { if (gm.GetService <LightsController>().lightsOn) { CastSearchingRay(); if (searchRayResult.collider != null) { Collider2D col = searchRayResult.collider; if (StaticUtilities.CheckIdentity <Ground>(col.gameObject)) { return; } if (StaticUtilities.CheckIdentity <RatbagPlayerBrain>(col.gameObject)) { foreach (ITargetUpdatable targetter in targettingComponents) { targetter.TargetFound(col.gameObject); } } } } } }
private void Update() { if (target != null) { if (!darknessLock) { darknessLock = true; } if (target == null) { if (!gm.GetService <LightsController>().lightsOn) { darknessLock = false; } } if (StaticUtilities.CheckIdentity <RatbagPlayerBrain>(target)) { Vector2 targetFacingDirection = target.GetComponent <FaceDirection>().direction; if (bouncerFacingDirection == targetFacingDirection) { Charge(chargeSpeed); // print("charge firing: " + chargeSpeed); for (int i = 0; i < componentsToUpdate.Length; i++) { IChargeUpdatable componentToUpdate = componentsToUpdate[i]; componentToUpdate.OnBouncerCharge(); } } } } }
private void KnockingTheTarget(GameObject target) { StartCoroutine(gm.GetService <DamageEffects>().PauseGameAndInvertColours()); Rigidbody2D targetRb = target.GetComponentInParent <Rigidbody2D>() ?? throw new ArgumentNullException("target.GetComponentInParent<Rigidbody2D>()"); if (playerRb.velocity.magnitude != 0) { AddForce_WhenPlayerMoving(targetRb); } else { AddForce_WhenPlayerStill(targetRb); } OnSoundPlayOneShot?.Invoke(audioLib.ratbag_Hitting); }
private void ChangeWeighting(float newWeight) { targetWeighting = newWeight; if (targetWeighting != CurrentWeighting) { CurrentWeighting = targetWeighting; if (changeWeightCoRoutine != null) { StopCoroutine(changeWeightCoRoutine); } changeWeightCoRoutine = gm.GetService <GroupTargetBrokerSmashBrosCamera>().ChangeCamTargetWeight(transform, CurrentWeighting); StartCoroutine(changeWeightCoRoutine); } }
public void TripTarget(GameObject target) { Rigidbody2D targetRb = target.GetComponent <Rigidbody2D>(); float torqueToAdd = targetRb.velocity.magnitude * tripForce; // Debug.Log("target tripped, torque added: " + torqueToAdd); targetRb.AddTorque(torqueToAdd); StartCoroutine(gm.GetService <CameraShake>().ShakingCamera(.1f, targetRb.velocity.magnitude / 4, targetRb.velocity.magnitude)); }
public void OnTrigger(Collider2D trigger) { if (StaticUtilities.CheckIdentity <Controllers.Bouncer>(trigger.gameObject)) { Controllers.Bouncer bc = StaticUtilities.ReturnControllerFromTrigger <Controllers.Bouncer>(trigger); if (!gm.GetService <LightsController>().lightsOn) { if (bc.currentState.BouncerKnockable()) { OnKnockTarget?.Invoke(trigger.gameObject); } } } }
public void OnTrigger(Collider2D trigger) { // Debug.Log("triggered: " + trig.gameObject.name); if (StaticUtilities.CheckIdentity <Controllers.Bouncer>(trigger.gameObject)) { Controllers.Bouncer bc = trigger.gameObject.GetComponentInParent <Controllers.Bouncer>(); // Debug.Log("bc = " + bc + " || lights on: " + gm.GetService<LightsController>().lightsOn); if (!gm.GetService <LightsController>().lightsOn) { if (bc.currentState.BouncerKnockable()) { OnKnockTarget?.Invoke(trigger.gameObject); } } } }
private void GetTimerDefaultFromResetService() { timerDefault = gm.GetService <GameReset>().GetSpawningTime(); }
private void CallingGameReset(GameObject player) { StartCoroutine(gm.GetService <GameReset>().ResetPlayer(player)); }