예제 #1
0
        public override void ApplyLevel(HandScreen screen, Hand hand, GameTime gameTime)
        {
            hand.Movement.HorizontalDirection = Direction.NONE;
            hand.Movement.VerticalDirection = Direction.DOWN;

            if (hand.CurrentAnimation.IsAnimating == true)
                hand.Movement.VerticalSpeed = 0;
            else
                hand.Movement.VerticalSpeed = speed;

            screen.NewHandReleaseInterval = releaseInterval;
        }
예제 #2
0
 private void AddToDictionaryIfNotAlready(Hand hand, GameTime gameTime)
 {
     var isKnownHand = lastChangedTimes.ContainsKey (hand);
     if (!isKnownHand)
         lastChangedTimes.Add (hand, gameTime.TotalGameTime);
 }
예제 #3
0
 public override void ApplyLevel(HandScreen screen, Hand hand, GameTime gameTime)
 {
     if (hand.CurrentAnimation.IsAnimating == false && hand.Origin.Y <= heightThreshold)
         UpdateHandType (hand, gameTime);
 }
예제 #4
0
 private void UpdateHandType(Hand hand, GameTime gameTime)
 {
     if (!hand.IsScheduledToDraw)
         lastChangedTimes.Remove (hand);
     else {
         AddToDictionaryIfNotAlready (hand, gameTime);
         RandomizeHandType (hand, gameTime);
     }
 }
예제 #5
0
 private void UpdateHandState(Hand hand)
 {
     var isInCollisionArea = IsInCollisionArea (hand.Rectangle);
     switch (hand.State) {
     case HandState.Active:
         if (isInCollisionArea)
             hand.State = HandState.Reactive;
         break;
     case HandState.Reactive:
         if (!isInCollisionArea)
             hand.State = HandState.Expired;
         break;
     default:
         break;
     }
 }
예제 #6
0
 private void StartHandAnimation(Hand hand, GameTime gameTime)
 {
     hand.StartAnimation (TimeSpan.FromSeconds (0.5), gameTime);
 }
 public abstract void ApplyLevel(HandScreen screen, Hand hand, GameTime gameTime);
예제 #8
0
		private MatchResult GetMatchResult (Hand tappedUserHand, GameTime gameTime)
		{
			return HandScreen.GetMatchResult (tappedUserHand, gameTime);
		}
예제 #9
0
 private bool IsInCollisionArea(Hand hand)
 {
     return hand.State == HandState.Reactive;
 }
예제 #10
0
        private Timing GetTapTiming(Hand hand)
        {
            var handCenterLine = hand.Origin.Y + hand.Size.Y / 2f;
            var collisionAreaCenterLine = CollisionArea.Top + CollisionArea.Height / 2f;
            var delta = Math.Abs (collisionAreaCenterLine - handCenterLine);
            var threshold = CollisionArea.Height / 2f;

            if (delta <= threshold)
                return Timing.Great;
            else if (delta <= threshold * 2)
                return Timing.Good;
            else if (delta <= hand.Size.Y / 2f + CollisionArea.Height / 2f)
                return Timing.SoSo;
            else
                return Timing.None;
        }
예제 #11
0
        private MatchResult GetMatchResult(Hand userHand, Hand hand)
        {
            if (userHand.Type == hand.Type)
                return new MatchResult (){ Result = ResultType.Draw };

            bool didUserWin = DidUserWin (userHand, hand);
            var matchResult = GetMatchResult (didUserWin);
            matchResult.TapTiming = GetTapTiming (hand);

            return matchResult;
        }
예제 #12
0
 private bool DidUserWin(Hand userHand, Hand hand)
 {
     switch (userHand.Type) {
     case HandType.Rock:
     case HandType.RockPressed:
         return hand.Type == HandType.Scissors;
     case HandType.Paper:
     case HandType.PaperPressed:
         return  hand.Type == HandType.Rock;
     case HandType.Scissors:
     case HandType.ScissorsPressed:
         return  hand.Type == HandType.Paper;
     default:
         throw new InvalidOperationException ("Not Recognized Hand Type");
     }
 }
예제 #13
0
 private void ApplyLevel(Hand hand, GameTime gameTime)
 {
     for (int i = 0, CurrentGameLevelCount = Levels.Count; i < CurrentGameLevelCount; i++)
         Levels [i].ApplyLevel (this, hand, gameTime);
 }
예제 #14
0
        public MatchResult GetMatchResult(Hand tappedUserHandn, GameTime gameTime)
        {
            var bottomHand = Hands.FirstOrDefault (x => x.State == HandState.Reactive);

            if (bottomHand == null)
                return new MatchResult (){ Result = ResultType.WrongTiming };

            if (IsInCollisionArea (bottomHand)) {
                var matchResult = GetMatchResult (tappedUserHandn, bottomHand);
                if (matchResult.Result == ResultType.Victory)
                    StartHandAnimation (bottomHand, gameTime);

                bottomHand.State = HandState.Destroyed;
                bottomHand.Freeze ();
                return matchResult;
            } else {
                return new MatchResult (){ Result = ResultType.WrongTiming };
            }
        }
 private MatchResult GetMatchResult(Hand tappedUserHand)
 {
     return HandScreen.GetMatchResult (tappedUserHand);
 }
예제 #16
0
 private void RandomizeHandType(Hand hand, GameTime gameTime)
 {
     var hasEnoughTimeElapsed = gameTime.TotalGameTime.Subtract (lastChangedTimes [hand]) >= TimeSpan.FromMilliseconds (changeInterval.TotalMilliseconds / 2 + changeInterval.TotalMilliseconds * random.NextDouble ());
     if (hasEnoughTimeElapsed) {
         HandType = GetRandomHandType ();
         hand.Type = HandType;
         lastChangedTimes [hand] = gameTime.TotalGameTime;
     }
 }
예제 #17
0
		private bool IsUserHandTapped (Hand userHand)
		{
			return !Hand.IsDummy (userHand);
		}
예제 #18
0
 private void ReleaseHand(Hand hand)
 {
     Hands.Add (hand);
 }
예제 #19
0
 private void RemoveIfNotValid(Hand hand)
 {
     if (!hand.IsScheduledToDraw)
         Hands.Remove (hand);
 }
예제 #20
0
 public static bool IsDummy(Hand hand)
 {
     return hand.Type == HandType.None;
 }