Esempio n. 1
0
        private void InitialPosition()
        {
            Rectangle initial = goriyaState.GetDestination();

            x = initial.X;
            y = initial.Y;

            if (direction == GoriyaStateMachine.Direction.Down)
            {
                x += goriyaState.GetWidth() / 2 - width * PIXELSCALER / 2;
                y += goriyaState.GetHeight();
            }
            else if (direction == GoriyaStateMachine.Direction.Up)
            {
                x += goriyaState.GetWidth() / 2 - width * PIXELSCALER / 2;
                y -= height * PIXELSCALER;
            }
            else if (direction == GoriyaStateMachine.Direction.Left)
            {
                x -= width * PIXELSCALER;
                y += goriyaState.GetHeight() / 2 - height * PIXELSCALER / 2;
            }
            else
            {
                x += goriyaState.GetWidth();
                y += goriyaState.GetHeight() / 2 - height * PIXELSCALER / 2;
            }
        }
Esempio n. 2
0
        public void Update()
        {
            if (!stateMachine.Throwing() && stateMachine.TryToThrow())
            {
                boomerang = new GoriyaBoomerang(goriyaSpriteSheet, stateMachine);
            }
            if (stateMachine.Throwing())
            {
                boomerang.Update();
            }

            stateMachine.Move();
            destination = stateMachine.GetDestination();
            source      = stateMachine.GetSource();
        }