Esempio n. 1
0
    public void OnKeydown(IntVector2 dir)
    {
        if (!turn)
        {
            return;
        }

        turn = false;

        StartCoroutine(Reset());
        print(stage.actors.Count);
        Action next = null;

        if (dir.Equals(Direction.NORTH))
        {
            next = new WalkAction(stage.hero, stage, Direction.NORTH);
        }
        else if (dir.Equals(Direction.EAST))
        {
            next = new WalkAction(stage.hero, stage, Direction.EAST);
        }
        else if (dir.Equals(Direction.SOUTH))
        {
            next = new WalkAction(stage.hero, stage, Direction.SOUTH);
        }
        else if (dir.Equals(Direction.WEST))
        {
            next = new WalkAction(stage.hero, stage, Direction.WEST);
        }

        if (next != null)
        {
            stage.hero.setNextAction(next);
        }
        TUpdate();
        gameBuilder.Display();
        //heroTrans.transform.position  = new Vector2 (stage.hero.pos.x * dungeon.tileSize.x/100,stage.hero.pos.x * dungeon.tileSize.x/100);
    }