예제 #1
0
        //TODO Construir mecanismo de chamar um delegate method when finish animation


        public Kaktos(Vector2 origin)
            : base(Color.White, origin)
        {
            Random rand = new Random(DateTime.Now.Millisecond);

            switch (rand.Next(0, 3))
            {
            case 0:
                up = new Kakto(Color.Blue, origin, Kakto.TYPE.UP);
                break;

            case 1:
                up = new Kakto(Color.Red, origin, Kakto.TYPE.UP);
                break;

            case 2:
                up = new Kakto(Color.Green, origin, Kakto.TYPE.UP);
                break;
            }

            switch (rand.Next(0, 3))
            {
            case 0:
                middle = new Kakto(Color.Blue, origin, Kakto.TYPE.MIDDLE);
                break;

            case 1:
                middle = new Kakto(Color.Red, origin, Kakto.TYPE.MIDDLE);
                break;

            case 2:
                middle = new Kakto(Color.Green, origin, Kakto.TYPE.MIDDLE);
                break;
            }

            switch (rand.Next(0, 3))
            {
            case 0:
                down = new Kakto(Color.Blue, origin, Kakto.TYPE.DOWN);
                break;

            case 1:
                down = new Kakto(Color.Red, origin, Kakto.TYPE.DOWN);
                break;

            case 2:
                down = new Kakto(Color.Green, origin, Kakto.TYPE.DOWN);
                break;
            }

            setCollisionRect(0, 0, 0, 0);
        }
예제 #2
0
        public bool checkCollisionWithMembers(GameObject gameobject)
        {
            bool collideWithAny = false;

            if (down.collidesWith(gameobject))
            {
                mCollided      = down;
                collideWithAny = true;
            }
            if (middle.collidesWith(gameobject))
            {
                mCollided      = middle;
                collideWithAny = true;
            }
            if (up.collidesWith(gameobject))
            {
                mCollided      = up;
                collideWithAny = true;
            }
            return(collideWithAny);
        }