예제 #1
0
 public void DeadCheck()
 {
     if (PlayerHitpoints.Hitpoints <= 0 && enabled)
     {
         GameEngineHelper.GetCurrentGameEngine().Defeat();
         PlayerHead.AnimateDeath();
     }
 }
예제 #2
0
        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);
        }
예제 #3
0
 void OnCollisionEnter2D(Collision2D col)
 {
     if (enabled)
     {
         AudioHandler.PlayAudio(_audioSource);
         GameEngineHelper.GetCurrentGameEngine().GameEvents.OnPlayerGoalCollision();
         this.enabled = false;
     }
 }
예제 #4
0
        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;
        }
예제 #5
0
 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;
     }
 }
예제 #6
0
 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);
         }
     }
 }
예제 #7
0
 public Vector3 GetLastInputPositionInWorld()
 {
     return(Camera.main.ScreenToWorldPoint(GameEngineHelper.GetCurrentGameEngine().InputHandler.GetLastPositionOfInput()));
 }
예제 #8
0
 void OnCollisionEnter2D(Collision2D col)
 {
     AudioHandler.PlayAudio(AudioSource);
     GameEngineHelper.GetCurrentGameEngine().Player.PlayerCollider.OnTrampolineCollision(col, Force);
 }
예제 #9
0
 public override void OnClick()
 {
     GameEngineHelper.GetCurrentGameEngine().TogglePause();
     base.OnClick();
 }
예제 #10
0
 protected override void OnTriggerEnter2D(Collider2D other)
 {
     GameEngineHelper.GetCurrentGameEngine().InterfaceHandler.DisplayFloatingText(DisplayText);
     enabled = false;
 }
예제 #11
0
 void Start()
 {
     GameEngineHelper.GetCurrentGameEngine().Player.transform.position = this.transform.position;
 }
예제 #12
0
 public void PauseInvoked(InputDeviceEnum inputDeviceEnum)
 {
     GameEngineHelper.GetCurrentGameEngine().TogglePause();
 }
예제 #13
0
 void OnCollisionEnter2D(Collision2D col)
 {
     AudioSource.clip = Resources.Load <AudioClip>("Audio/InteractingObjectsAudio/HazardsAudio/SawBladeDamage");
     AudioHandler.PlayAudio(AudioSource);
     GameEngineHelper.GetCurrentGameEngine().Player.PlayerCollider.OnHazardCollision(col);
 }
예제 #14
0
파일: Ice.cs 프로젝트: PhilipSA/ProjectGame
 void OnCollisionStay2D(Collision2D col)
 {
     AudioPlayer.PlayOnce(AudioSource);
     GameEngineHelper.GetCurrentGameEngine().Player.PlayerCollider.OnIceCollision(col);
 }