Example #1
0
        public Actor.Actor checkGrab(Max aux, GameTime gameTime, InputHandler inputHandler)
        {
            Point grab = aux.Grab(inputHandler);

            Actor.Actor returnable = null;

            if (grab != Point.Zero)
            {
                foreach (Actor.Actor ac in actors)
                {
                    if (ac.GetType() == typeof(Rock))
                    {
                        //Console.WriteLine("grabbed");
                        Rock auxRock = (Rock)ac;
                        if (auxRock.collisionRect.Contains(grab))
                        {
                            aux.state.ChangeState(new GrabState(aux, aux.state));
                            returnable = ac;
                        }
                    }
                }
            }
            return(returnable);
        }