Пример #1
0
        public void addEnemy(EnemiesTypes type, Color c, Vector2 location)
        {
            BaseEnemy enemy = null;

            switch (type)
            {
            case EnemiesTypes.CrabCrab:
                enemy = new EnemyCrabCrab(c, location);
                break;

            case EnemiesTypes.Lizardo:
                enemy = new Lizardo(c, location);
                break;

            case EnemiesTypes.Mongo:
                enemy = new EnemyMongo(EnemyMongo.SKIN.Normal, c, location);
                break;

            case EnemiesTypes.MongoPirate:
                enemy = new EnemyMongo(EnemyMongo.SKIN.Pirate, c, location);
                break;

            case EnemiesTypes.Bako:
                enemy = new Bako(c, location);
                break;

            case EnemiesTypes.Kaktos:
                enemy = new Kaktos(location);
                break;

            case EnemiesTypes.Rocker:
                enemy = new Rocker(c, location);
                break;

            case EnemiesTypes.Balloon:
                //enemy = new Balloon(c, location);
                break;
            }

            enemy.setLocation(location);
            mList.Add(enemy);
        }
Пример #2
0
        public bool checkCollisionWith(GameObject gameObject)
        {
            for (int x = 0; x < mList.Count; x++)
            {
                //  Game1.print("X,Y ELEMENT: " + mList.ElementAt(x).getX() + mList.ElementAt(x).getY() + "--- X,Y BUCCET: " + gameObject.getX() + gameObject.getY());
                if (mList.ElementAt(x) is Kaktos)
                {
                    GameObject kaktos = (GameObject)mList.ElementAt(x);
                    Kaktos     k      = (Kaktos)kaktos;

                    if (!k.isEmpty())
                    {
                        if (k.checkCollisionWithMembers(gameObject))
                        {
                            Game1.print("COLLIDIU COM KAKTOO");

                            mCollidedObject = k.getCollided();
                            return(true);
                        }
                    }
                    else
                    {
                        k.destroy();
                    }
                }
                else
                {
                    if (mList.ElementAt(x).collidesWith(gameObject))
                    {
                        mCollidedObject = mList.ElementAt(x);
                        return(true);
                    }
                }
            }

            mCollidedObject = null;
            return(false);
        }