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);
        }
    public StateStalfosNormal(Stalfos _s, SpriteRenderer _renderer, Sprite[] _animation) {
        s = _s;
        rb = s.GetComponent<Rigidbody>();
        renderer = _renderer;
        animation = _animation;

        s.GoToMiddleOfTile();

        //Debug.Log(Tile.Unwalkable(new Vector3(36, 49)));

        do {
            direction = Utils.RandomDirection4();
            nextCell = new Vector3((int)s.transform.position.x + (direction.x), (int)s.transform.position.y + (direction.y), 0);
        } while (Tile.Unwalkable(nextCell) || Utils.CollidingWithAnyWall(nextCell));
        

    }
Exemple #3
0
    public StateStalfosNormal(Stalfos _s, SpriteRenderer _renderer, Sprite[] _animation)
    {
        s         = _s;
        rb        = s.GetComponent <Rigidbody>();
        renderer  = _renderer;
        animation = _animation;

        s.GoToMiddleOfTile();

        //Debug.Log(Tile.Unwalkable(new Vector3(36, 49)));

        do
        {
            direction = Utils.RandomDirection4();
            nextCell  = new Vector3((int)s.transform.position.x + (direction.x), (int)s.transform.position.y + (direction.y), 0);
        } while (Tile.Unwalkable(nextCell) || Utils.CollidingWithAnyWall(nextCell));
    }