Exemple #1
0
        private IEntity CreateEnemy(String type, Vector2 startingPos, Vector2 abstractPos)
        {
            IEntity newEnemy = new Keese(game, startingPos);

            switch (type)
            {
            case "Aquamentus":
                newEnemy = new Aquamentus(game, startingPos);
                break;

            case "BoggusBoss":
                newEnemy = new BoggusBoss(game, startingPos);
                break;

            case "MarioBoss":
                newEnemy = new MarioBoss(game, startingPos);
                break;

            case "Dodongo":
                newEnemy = new Dodongo(game, startingPos);
                break;

            case "Gel":
                newEnemy = new Gel(game, startingPos);
                break;

            case "Zol":
                newEnemy = new Zol(game, startingPos);
                break;

            case "Goriya":
                newEnemy = new Goriya(game, startingPos);
                break;

            case "Keese":
                newEnemy = new Keese(game, startingPos);
                break;

            case "Stalfos":
                newEnemy = new Stalfos(game, startingPos);
                break;

            case "Rope":
                newEnemy = new Rope(game, startingPos);
                break;

            case "Wallmaster":
                newEnemy = new WallMaster(game, startingPos, abstractPos);
                break;

            default:
                break;
            }
            return(newEnemy);
        }
Exemple #2
0
    public StateKeeseNormal(Keese _p, SpriteRenderer _renderer, Sprite[] _animation)
    {
        p = _p;
        renderer = _renderer;
        animation = _animation;
        animation_length = animation.Length;

        time_max = time_stopped = (1 + Random.value) / 2 * (72 * normal_seconds);

        GoToRandomCell();

        if (this.animation_length <= 0)
            Debug.LogError("Empty animation submitted to state machine!");
    }
Exemple #3
0
    public StateKeeseNormal(Keese _p, SpriteRenderer _renderer, Sprite[] _animation)
    {
        p                = _p;
        renderer         = _renderer;
        animation        = _animation;
        animation_length = animation.Length;

        time_max = time_stopped = (1 + Random.value) / 2 * (72 * normal_seconds);

        GoToRandomCell();

        if (this.animation_length <= 0)
        {
            Debug.LogError("Empty animation submitted to state machine!");
        }
    }
Exemple #4
0
    private float time_stopped; // Between half and all of pause_seconds.

    public StateKeeseStopped(Keese _p)
    {
        p            = _p;
        time_stopped = (1 + Random.value) / 2 * (72 * pause_seconds);
    }
Exemple #5
0
        private Entity LoadEnemy(Vector2 pos, string enemyType, string startDirection, string itemHeld)
        {
            Entity entity;

            Console.WriteLine("Initializing enemy at pos " + pos);

            if (startDirection.Equals(""))
            {
                startDirection = "right";
            }

            // Parse direction (passed in as string) into Direction enumerable type
            Constants.Direction direction;
            switch (startDirection)
            {
            case "up":
                direction = Constants.Direction.UP;
                break;

            case "right":
                direction = Constants.Direction.RIGHT;
                break;

            case "down":
                direction = Constants.Direction.DOWN;
                break;

            case "left":
                direction = Constants.Direction.LEFT;
                break;

            default:     // start direction not neccessary, default is right
                direction = Constants.Direction.RIGHT;
                break;
            }

            switch (enemyType)
            {
            case "aquamentus":
                entity = new Aquamentus(pos);
                break;

            case "bladetrap":
                entity = new BladeTrap(pos);
                break;

            case "gel":
                entity = new Gel(pos);
                break;

            case "goriya":
                entity = new Goriya(pos);
                break;

            case "keese":
                entity = new Keese(pos);
                break;

            case "rope":
                entity = new Rope(pos);
                break;

            case "stalfo":
                entity = new Stalfo(pos);
                if (itemHeld == "regularkey")
                {
                    BasicSprite keySprite = ItemSpriteFactory.Instance.CreateRegularKey();
                    keySprite.offsets = new List <Vector2> {
                        new Vector2(4, 0)
                    };
                    entity.AddComponent(new Sprite(keySprite));
                    entity.GetComponent <StalfoMovement>().SetItemHeldTrue();
                }
                break;

            case "wallmaster":
                entity = new WallMaster(pos, direction);
                break;

            default:
                Console.WriteLine("Level @ LoadEnemy(): Unrecognized enemyType \"" + enemyType + "\"!");
                return(null);
            }
            var poof = new Poof(pos, entity);

            Scene.Add(entity);
            Scene.Add(poof);
            var transform = Root.GetComponent <Transform>();

            transform.AddChild(poof);
            numEnemiesLeft++;

            enemyList.Add((Enemy)entity);

            return(entity);
        }
Exemple #6
0
    private float time_stopped; // Between half and all of pause_seconds.

    public StateKeeseStopped(Keese _p)
    {
        p = _p;
        time_stopped = (1 + Random.value) / 2 * (72 * pause_seconds);
    }
Exemple #7
0
        private Entity LoadEnemy(Vector2 pos, string enemyType, string startDirection, string itemHeld)
        {
            Entity entity = null;

            // Parse direction (passed in as string) into Direction enumerable type
            Constants.Direction direction;
            switch (startDirection)
            {
            case "up":
                direction = Constants.Direction.UP;
                break;

            case "right":
                direction = Constants.Direction.RIGHT;
                break;

            case "down":
                direction = Constants.Direction.DOWN;
                break;

            case "left":
                direction = Constants.Direction.LEFT;
                break;

            default:     // start direction not neccessary, default is right
                direction = Constants.Direction.RIGHT;
                break;
            }

            switch (enemyType)
            {
            case "aquamentus":
                entity = new Aquamentus(pos);
                break;

            case "bladetrap":
                entity = new BladeTrap(pos);
                break;

            case "gel":
                entity = new Gel(pos);
                break;

            //case "goriya":
            //    entity = new Goriya(pos);
            //    break;
            case "keese":
                entity = new Keese(pos);
                break;

            case "rope":
                entity = new Rope(pos);
                break;

            case "stalfo":
                entity = new Stalfo(pos);
                if (itemHeld == "regularkey")
                {
                    entity.AddComponent(new Sprite(ItemSpriteFactory.Instance.CreateRegularKey()));
                    entity.GetComponent <StalfoMovement>().SetItemHeldTrue();
                }
                break;

            case "wallmaster":
                entity = new WallMaster(pos, direction);
                break;

            default:
                Console.WriteLine("Level @ LoadEnemy(): Unrecognized enemyType \"" + enemyType + "\"!");
                return(null);
            }
            Scene.Add(entity);
            Scene.Add(new Poof(pos, entity));
            return(entity);
        }