public void DeadCheck() { if (PlayerHitpoints.Hitpoints <= 0 && enabled) { GameEngineHelper.GetCurrentGameEngine().Defeat(); PlayerHead.AnimateDeath(); } }
public void AnglePlayerTowardsInputOnBounce() { var inputPosition = GameEngineHelper.GetCurrentGameEngine().InputHandler.GetLastPositionOfInput(); var normalizedAngle = inputPosition.x - Camera.main.WorldToScreenPoint(Player.transform.position).x; var forceFactor = IntervalConverter.ConvertValueInIntervalToOtherIntervalValue(MaxNegativeInputDistance, MaxPositiveInputDistance, MinBounceStep, MaxBounceStep, normalizedAngle); Player.PlayerRigidbody2D.AddTorque(-forceFactor * 100, ForceMode2D.Impulse); }
void OnCollisionEnter2D(Collision2D col) { if (enabled) { AudioHandler.PlayAudio(_audioSource); GameEngineHelper.GetCurrentGameEngine().GameEvents.OnPlayerGoalCollision(); this.enabled = false; } }
void Start() { Player = GameEngineHelper.GetCurrentGameEngine().Player; Camera = GetComponent <Camera>(); var boundsRect = GameObject.Find("BoundingBox").GetComponent <RectTransform>(); CameraBounds.center = boundsRect.rect.center; CameraBounds.min = boundsRect.offsetMin; CameraBounds.max = boundsRect.offsetMax; }
void Update() { BarDisplay = IntervalConverter.ConvertValueInIntervalToOtherIntervalValue(PlayerBounceLogic.MinimumBouncePower, PlayerBounceLogic.MaximumBouncePower, 1, 10, GameEngineHelper.GetCurrentGameEngine().Player.PlayerBounceLogic.GetBouncePower()); foreach (var bar in _barsList) { bar.enabled = _barsList.IndexOf(bar) <= BarDisplay; } }
void Update() { if (HeadRigidbody2D.velocity.magnitude > 200) { SpriteAnimation.AnimateBlink(EnumHelper.GetMemberName(() => PlayerHeadAnimationsEnum.HeadHighRes), EnumHelper.GetMemberName(() => PlayerHeadAnimationsEnum.HeadHighResExcited), PlayerHeadAnimationsEnum.HeadHighResExcited); } foreach (var collider in Physics2D.OverlapBoxAll(GameEngineHelper.GetCurrentGameEngine().MainCamera.transform.position, new Vector2(100, 100), 0)) { if (Vector2.Distance(collider.bounds.ClosestPoint(transform.position), transform.position) < 25 && collider.name.Contains("Quad")) { SpriteAnimation.AnimateBlink(EnumHelper.GetMemberName(() => PlayerHeadAnimationsEnum.HeadHighRes), EnumHelper.GetMemberName(() => PlayerHeadAnimationsEnum.HeadHighResPanic), PlayerHeadAnimationsEnum.HeadHighResPanic); } } }
public Vector3 GetLastInputPositionInWorld() { return(Camera.main.ScreenToWorldPoint(GameEngineHelper.GetCurrentGameEngine().InputHandler.GetLastPositionOfInput())); }
void OnCollisionEnter2D(Collision2D col) { AudioHandler.PlayAudio(AudioSource); GameEngineHelper.GetCurrentGameEngine().Player.PlayerCollider.OnTrampolineCollision(col, Force); }
public override void OnClick() { GameEngineHelper.GetCurrentGameEngine().TogglePause(); base.OnClick(); }
protected override void OnTriggerEnter2D(Collider2D other) { GameEngineHelper.GetCurrentGameEngine().InterfaceHandler.DisplayFloatingText(DisplayText); enabled = false; }
void Start() { GameEngineHelper.GetCurrentGameEngine().Player.transform.position = this.transform.position; }
public void PauseInvoked(InputDeviceEnum inputDeviceEnum) { GameEngineHelper.GetCurrentGameEngine().TogglePause(); }
void OnCollisionEnter2D(Collision2D col) { AudioSource.clip = Resources.Load <AudioClip>("Audio/InteractingObjectsAudio/HazardsAudio/SawBladeDamage"); AudioHandler.PlayAudio(AudioSource); GameEngineHelper.GetCurrentGameEngine().Player.PlayerCollider.OnHazardCollision(col); }
void OnCollisionStay2D(Collision2D col) { AudioPlayer.PlayOnce(AudioSource); GameEngineHelper.GetCurrentGameEngine().Player.PlayerCollider.OnIceCollision(col); }