예제 #1
0
        public Actor.Actor checkKick(Max aux, GameTime gameTime, InputHandler inputHandler)
        {
            Point kick = aux.Kick(inputHandler);

            Actor.Actor returnable = null;
            if (kick != Point.Zero)
            {
                foreach (Actor.Actor ac in actors)
                {
                    if (ac.GetType() == typeof(Block))
                    {
                        Block auxBlock = (Block)ac;
                        //Console.WriteLine(auxBlock.collisionRect.ToString());
                        //Console.WriteLine(auxBlock.collisionRect.Intersects(new Rectangle(kick, new Point(10, 10))));
                        if (auxBlock.collisionRect.Contains(kick.X, kick.Y))
                        {
                            aux.state.ChangeState(new KickState(aux.state, aux));
                            auxBlock.setDir(CalculateVector(kick - aux.position.ToPoint()));
                            auxBlock.Update(gameTime, inputHandler);
                            returnable = ac;
                        }
                    }
                }
            }
            return(returnable);
        }