Exemplo n.º 1
0
 private void Throwing()
 {
     if (mThrowingStatus == 0)
     {
         mStateDuration--;
         if (mStateDuration < 0)
         {
             mThrowingStatus      += 2;
             mStateDuration        = 8;
             mAnimation.FrameValue = 2;
             FireCoconut();
         }
     }
     else if (mThrowingStatus == 2)
     {
         mStateDuration--;
         if (mStateDuration < 0)
         {
             mThrowingStatus = 0;
             mStatus         = CoconutsState.Climbing;
             mStateDuration  = 8;
             SetClimbVelocity();
         }
     }
 }
Exemplo n.º 2
0
        private void Climbing()
        {
            mStateDuration--;

            // Has climb finished
            if (mStateDuration == 0)
            {
                mStatus        = CoconutsState.Resting;
                mStateDuration = 16;
                return;
            }

            // Update climb position
            UpdatePosition();
            mAnimation.Update();
        }
Exemplo n.º 3
0
        private void Rest()
        {
            //  a1 = address of closest player character
            //  d0 = 0 if right from player, 2 if left
            //  d1 = 0 if above player, 2 if under
            //  d2 = horizontal distance to closest character
            //  d3 = vertical distance to closest character

            int directionX = 0;
            int directionY = 0;
            int horizDist  = 12;
            int vertDist   = 80;

            Level.GetClosestCharacter(this, out directionX, out directionY, out horizDist, out vertDist);

            // Set direction coconuts is facing
            mFacingRight = (directionX != 0);

            // Is player in range
            if (horizDist + 96 < 192 && Math.Abs(vertDist) < 100)
            {
                if (mThrowWaitDuration == 0)
                {
                    mStatus = CoconutsState.Throwing;
                    mAnimation.FrameValue = 1;
                    mStateDuration        = 8;
                    mThrowWaitDuration    = 32;
                    return;
                }
                mThrowWaitDuration--;
            }

            mStateDuration--;

            // If rest has finished, start climb
            if (mStateDuration < 0)
            {
                mStatus = CoconutsState.Climbing;
                SetClimbVelocity();
            }
        }
Exemplo n.º 4
0
 private void Init()
 {
     // Start rest
     mStateDuration = 16;
     mStatus        = CoconutsState.Resting;
 }