Beispiel #1
0
    public override List <Tile> GetPossibleMovements(Slime slime)
    {
        List <Tile> tiles = new List <Tile>();

        switch (tutorialStatus)
        {
        case TutorialFSMStatus.MOVEFIRSTSLIME:
            tiles.Add(MapDrawer.GetTileAt(-1, -3));
            break;

        case TutorialFSMStatus.RETURNSLIME:
            tiles.Add(MapDrawer.GetTileAt(0, -2));
            break;

        case TutorialFSMStatus.MOVESECONDARYSLIME:
            if (selectedSlime != playerSlime && selectedSlime != null)
            {
                tiles.Add(MapDrawer.GetTileAt(1, -2));
            }
            break;

        case TutorialFSMStatus.MOVETOCONQUER:
            tiles.Add(MapDrawer.GetTileAt(-1, -1));
            break;
        }
        return(tiles);
    }
Beispiel #2
0
    protected override void ThinkAction()
    {
        position++;
        Slime actionSlime = null;

        if (position == 3)
        {
            actionSlime = gameController.GetCurrentPlayer().GetSlimes()[1];
        }
        else
        {
            actionSlime = gameController.GetCurrentPlayer().GetSlimes()[0];
        }


        //Solucio cutre
        if (actions[position].GetAction() == ActionType.ATTACK)
        {
            actions[position] = new SlimeAction(ActionType.ATTACK, MapDrawer.GetTileAt(-1, -1).GetSlimeOnTop());
        }
        if (position >= actions.Count)
        {
            thoughtAction = new AISlimeAction(actionSlime, ActionType.CONQUER, gameController.GetSelectedSlime().actualTile);
        }
        thoughtAction = new AISlimeAction(actionSlime, actions[position]);
    }
Beispiel #3
0
    public override List <Tile> GetSplitRangeTiles(Slime slime)
    {
        List <Tile> tiles = new List <Tile> ();

        switch (tutorialStatus)
        {
        case TutorialFSMStatus.SPLITSLIME:
            tiles.Add(MapDrawer.GetTileAt(0, -1));
            break;
        }
        return(tiles);
    }
Beispiel #4
0
 public void setTutorialActions()
 {
     tutorialActions.Add(new SlimeAction(ActionType.SPLIT, MapDrawer.GetTileAt(3, -3)));
     tutorialActions.Add(new SlimeAction(ActionType.MOVE, MapDrawer.GetTileAt(1, -2)));
     tutorialActions.Add(new SlimeAction(ActionType.MOVE, MapDrawer.GetTileAt(1, -1))); //Slime 1
     tutorialActions.Add(new SlimeAction(ActionType.MOVE, MapDrawer.GetTileAt(-1, -1)));
     tutorialActions.Add(new SlimeAction(ActionType.CONQUER, MapDrawer.GetTileAt(-1, -1)));
     tutorialActions.Add(new SlimeAction(ActionType.MOVE, MapDrawer.GetTileAt(0, -1)));    //Slime 1
     tutorialActions.Add(new SlimeAction(ActionType.FUSION, MapDrawer.GetTileAt(-1, -1))); //Slime 1
     tutorialActions.Add(new SlimeAction(ActionType.ATTACK, MapDrawer.GetTileAt(-3, 0)));
     //tutorialActions.Add(new SlimeAction(ActionType.CONQUER, MapDrawer.GetTileAt(-1, -1)));
     tutorialActions.Add(new SlimeAction(ActionType.ATTACK, MapDrawer.GetTileAt(-2, 1)));
 }
Beispiel #5
0
    public TutorialIA(GameController gameController) : base(gameController)
    {
        position = -1;
        actions  = new List <SlimeAction>();

        //Init actions
        actions.Add(new SlimeAction(ActionType.CONQUER, MapDrawer.GetTileAt(-4, 1)));
        actions.Add(new SlimeAction(ActionType.MOVE, MapDrawer.GetTileAt(-3, 2)));
        actions.Add(new SlimeAction(ActionType.SPLIT, MapDrawer.GetTileAt(-2, 1)));
        actions.Add(new SlimeAction(ActionType.ATTACK, MapDrawer.GetTileAt(-1, -1))); //Slime 1
        actions.Add(new SlimeAction(ActionType.MOVE, MapDrawer.GetTileAt(-3, 0)));
        actions.Add(new SlimeAction(ActionType.ATTACK, MapDrawer.GetTileAt(-1, -1)));
        actions.Add(new SlimeAction(ActionType.ATTACK, MapDrawer.GetTileAt(-1, -1)));
    }
Beispiel #6
0
    public override List <Tile> GetSlimesInAttackRange(Slime slime)
    {
        List <Tile> tiles = new List <Tile> ();

        switch (tutorialStatus)
        {
        case TutorialFSMStatus.ATTACKSLIME:
            tiles.Add(MapDrawer.GetTileAt(0, 0));
            break;

        default:
            break;
        }
        return(tiles);
    }
Beispiel #7
0
    public override List <Tile> GetJoinTile(Slime slime)
    {
        List <Tile> tiles = new List <Tile> ();

        switch (tutorialStatus)
        {
        case TutorialFSMStatus.JOINSLIME:
            if (selectedSlime != playerSlime && selectedSlime != null)
            {
                tiles.Add(MapDrawer.GetTileAt(0, -2));
            }
            break;
        }
        return(tiles);
    }
    public AISlimeAction CopyToRealAction(GameController gameController)
    {
        Slime actionSlime = gameController.FindSlimeById(GetMainSlimeId());

        switch (GetAction())
        {
        case ActionType.ATTACK:
        case ActionType.FUSION:
        case ActionType.EAT:
            Slime targetSlime = gameController.FindSlimeById(GetTargetSlimeId());
            return(new AISlimeAction(actionSlime, GetAction(), targetSlime));

        default:
            Tile tile = MapDrawer.GetTileAt((int)GetTileVector().x, (int)GetTileVector().y);
            return(new AISlimeAction(actionSlime, GetAction(), tile));
        }
    }
Beispiel #9
0
    public virtual List <Tile> GetJoinTile(Slime slime)
    {
        List <Vector2> directions = new List <Vector2> {
            new Vector2(0, -1), new Vector2(1, -1), new Vector2(1, 0), new Vector2(0, 1), new Vector2(-1, 1), new Vector2(-1, 0)
        };
        List <Tile> tileList = new List <Tile>();

        foreach (Vector2 v in directions)
        {
            int x = (int)(slime.actualTile.getPosition().x + v.x);
            int y = (int)(slime.actualTile.getPosition().y + v.y);
            if (MapDrawer.GetTileAt(x, y) != null &&
                MapDrawer.GetTileAt(x, y).GetSlimeOnTop() != null &&
                MapDrawer.GetTileAt(x, y).GetSlimeOnTop().GetPlayer() == slime.GetPlayer())
            {
                tileList.Add(MapDrawer.GetTileAt(x, y));
            }
        }
        return(tileList);
    }
Beispiel #10
0
    public virtual List <Tile> GetPossibleMovements(Slime slime)
    {
        ArrayList   tiles    = new ArrayList();
        ArrayList   distance = new ArrayList();
        List <Tile> visited  = new List <Tile> ();

        //List<Tile> moveTiles = new List<Tile> ();

        int moveRange = slime.GetMovementRange();

        List <Vector2> directions = new List <Vector2> {
            new Vector2(0, -1), new Vector2(1, -1), new Vector2(1, 0), new Vector2(0, 1), new Vector2(-1, 1), new Vector2(-1, 0)
        };

        tiles.Add(slime.GetActualTile());
        distance.Add(0);
        int counter = 0;

        while (tiles.Count > 0)
        {
            Tile t = (Tile)tiles[0];
            tiles.RemoveAt(0);
            int prevD = (int)distance[0];
            distance.RemoveAt(0);
            counter++;
            visited.Add(t);
            foreach (Vector2 vec in directions)
            {
                int  x    = (int)(t.getPosition().x + vec.x);
                int  y    = (int)(t.getPosition().y + vec.y);
                Tile newT = MapDrawer.GetTileAt(x, y);
                if (!visited.Contains(newT) && !tiles.Contains(newT) && newT != null && prevD + 1 <= moveRange && !newT.GetTileData().isBlocking())
                {
                    tiles.Add(newT);
                    distance.Add(prevD + 1);
                }
            }
        }
        visited.RemoveAt(0);
        return(visited);
    }
    public static Slime instantiateSlime(Player pl, int x, int y)
    {
        GameObject slimeGameObjectContainer = new GameObject("Slime " + (pl.GetNumSlimes() + 1).ToString() + " - " + pl.GetName());
        GameObject slime = new GameObject("Core");

        slime.transform.SetParent(slimeGameObjectContainer.transform);
        slime.AddComponent <SpriteRenderer>();
        slime.tag = "Slime";
        GameObject face = new GameObject("SlimeFace");

        face.AddComponent <SpriteRenderer> ();
        face.transform.SetParent(slime.transform);
        face.GetComponent <SpriteRenderer>().sortingLayerName = "TileElement";
        face.GetComponent <SpriteRenderer> ().sprite          = SpritesLoader.GetInstance().GetResource(pl.statsCoreInfo.picDirection);
        slime.AddComponent <Slime>().face                      = face;
        slime.GetComponent <SpriteRenderer>().sprite           = SpritesLoader.GetInstance().GetResource(StatsFactory.GetStat(ElementType.NONE).picDirection + 0);
        slime.GetComponent <SpriteRenderer>().sortingLayerName = "TileElement";
        slime.AddComponent <BoxCollider2D>();
        slime.AddComponent <SlimeMovement>().parent = slimeGameObjectContainer;

        pl.AddSlime(slime.GetComponent <Slime>());


        Tile    tile = MapDrawer.GetTileAt(x, y);
        Vector2 tileWorldPosition = tile.GetTileData().GetRealWorldPosition();        //MapDrawer.drawInternCoordenates(new Vector2(x0, y0));

        slimeGameObjectContainer.transform.position = new Vector3(tileWorldPosition.x, tileWorldPosition.y, 0f);
        slime.GetComponent <Slime>().SetActualTile(tile);
        slime.GetComponent <Slime> ().InitElementTypeNone();
        slime.GetComponent <Slime>().setPlayer(pl);
        slime.transform.localPosition = new Vector3(0f, 0.35f, 0f);

        slime.GetComponent <Slime>().SetId(ID);
        ID++;
        return(slime.GetComponent <Slime> ());
    }
Beispiel #12
0
    public void tutorialFSMCheck()
    {
        List <String> texts = new List <String>();

        switch (tutorialStatus)
        {
        case TutorialFSMStatus.SELECTSLIME:
            chainTextDialog.Hide();
            texts.Add("¿Has visto que ha aparecido alrededor?\nEsas son las casillas por las que tu slime se puede mover en una acción");
            texts.Add("Prueba a moverte aquí");
            chainTextDialog.SetTextList(texts);
            chainTextDialog.Show();
            chainTextDialog.SetOnClickFunction(() => {
                inputController.SetActiveInput(true);
                marker.SetActive(true);
                marker.SetParentTransform(MapDrawer.GetTileAt(-1, -3).transform);
            });
            inputController.SetActiveInput(false);
            inputController.SetActiveMove(true);
            tutorialStatus = TutorialFSMStatus.MOVEFIRSTSLIME;
            break;

        case TutorialFSMStatus.MOVEFIRSTSLIME:
            texts.Add("Muy bien.\nAhora vuelve a donde estabas");
            chainTextDialog.SetTextList(texts);
            chainTextDialog.Show();
            chainTextDialog.SetOnClickFunction(() => {
            });
            inputController.SetActiveInput(true);
            inputController.SetActiveMove(true);
            marker.SetActive(true);
            marker.SetParentTransform(MapDrawer.GetTileAt(0, -2).transform);
            tutorialStatus = TutorialFSMStatus.RETURNSLIME;
            break;

        case TutorialFSMStatus.RETURNSLIME:
            texts.Add("Perfecto");
            texts.Add("¿Sabias que los slimes pueden hacer muchas mas cosas además de moverse?");
            texts.Add("Ya verás, si mantienes pulsado el slime verás que se marcan alrededor unas casillas.\nPrueba a arrastrar y soltar encima de esas casillas a ver que pasa");
            chainTextDialog.SetTextList(texts);
            chainTextDialog.Show();
            chainTextDialog.SetOnClickFunction(() => {
                inputController.SetActiveInput(true);
                marker.SetActive(true);
                marker.SetParentTransform(MapDrawer.GetTileAt(0, -1).transform);
            });
            inputController.SetActiveInput(false);
            inputController.SetActiveMove(false);
            inputController.SetActiveSplit(true);
            marker.SetActive(false);
            tutorialStatus = TutorialFSMStatus.SPLITSLIME;
            break;

        case TutorialFSMStatus.SPLITSLIME:
            texts.Add("Wow, se han separado");
            texts.Add("Como has conseguido separarte puedes ovservar que la cantidad de acciones que puedes hacer en un turno ha aumentado");
            texts.Add("Mueve el nuevo slime aquí");
            chainTextDialog.SetTextList(texts);
            chainTextDialog.Show();
            chainTextDialog.SetOnClickFunction(() => {
                inputController.SetActiveInput(true);
                marker.SetActive(true);
                marker.SetParentTransform(MapDrawer.GetTileAt(1, -2).transform);
            });
            inputController.SetActiveSplit(false);
            inputController.SetActiveInput(false);
            inputController.SetActiveMove(true);
            tutorialStatus = TutorialFSMStatus.MOVESECONDARYSLIME;
            break;

        case TutorialFSMStatus.MOVESECONDARYSLIME:
            texts.Add("Para juntar tu slime, has de hacer lo mismo que para separarlo pero sobre el slime nuevo");
            chainTextDialog.SetTextList(texts);
            chainTextDialog.Show();
            chainTextDialog.SetOnClickFunction(() => {
                inputController.SetActiveInput(true);
                inputController.SetActiveJoin(true);
                marker.SetActive(true);
                marker.SetParentTransform(MapDrawer.GetTileAt(1, -2).transform);
            });
            tutorialStatus = TutorialFSMStatus.JOINSLIME;
            break;

        case TutorialFSMStatus.JOINSLIME:
            texts.Add("¡Cuidado! Un slime enemigo ha aparecido, prueba a atacarle");
            chainTextDialog.SetTextList(texts);
            chainTextDialog.Show();
            chainTextDialog.SetOnClickFunction(() => {
                inputController.SetActiveAttack(true);
                inputController.SetActiveInput(true);
                marker.SetActive(true);
                marker.SetParentTransform(MapDrawer.GetTileAt(0, 0).transform);
            });
            Player p = new Player("Sida", StatsFactory.GetStat(SlimeCoreTypes.INNOCENCE));
            p.SetColor(new Color(1, 0, 0));
            SlimeFactory.instantiateSlime(p, 0, 0);
            inputController.SetActiveJoin(false);
            inputController.SetActiveInput(false);
            marker.SetActive(false);
            inputController.SetActiveInput(false);
            tutorialStatus = TutorialFSMStatus.ATTACKSLIME;
            break;

        case TutorialFSMStatus.ATTACKSLIME:
            texts.Add("¿Por que no conviertes conquistas una casilla y te curas?");
            chainTextDialog.SetTextList(texts);
            chainTextDialog.Show();
            chainTextDialog.SetOnClickFunction(() => {
                inputController.SetActiveMove(true);
                inputController.SetActiveInput(true);
                marker.SetActive(true);
                marker.SetParentTransform(MapDrawer.GetTileAt(-1, -1).transform);
            });
            inputController.SetActiveJoin(false);
            inputController.SetActiveInput(false);
            inputController.SetActiveMove(false);
            marker.SetActive(false);
            tutorialStatus = TutorialFSMStatus.MOVETOCONQUER;
            break;

        case TutorialFSMStatus.MOVETOCONQUER:
            texts.Add("Ahora selecciona tu slime y vuelve a hacer click en el");
            chainTextDialog.SetTextList(texts);
            chainTextDialog.Show();
            chainTextDialog.SetOnClickFunction(() => {
                inputController.SetActiveConquer(true);
                inputController.SetActiveInput(true);
                marker.SetActive(true);
                marker.SetParentTransform(MapDrawer.GetTileAt(-1, -1).transform);
            });
            inputController.SetActiveInput(false);
            inputController.SetActiveConquer(false);
            inputController.SetActiveMove(false);
            marker.SetActive(false);
            tutorialStatus = TutorialFSMStatus.CONQUERTILE;
            break;

        case TutorialFSMStatus.CONQUERTILE:
            texts.Add("Vuelve a tocar la casilla conquistada para curarte");
            chainTextDialog.SetTextList(texts);
            chainTextDialog.Show();
            chainTextDialog.SetOnClickFunction(() => {
                inputController.SetActiveEat(true);
                inputController.SetActiveConquer(true);
                inputController.SetActiveInput(true);
                marker.SetActive(true);
                marker.SetParentTransform(MapDrawer.GetTileAt(-1, -1).transform);
            });
            inputController.SetActiveInput(false);
            inputController.SetActiveEat(false);
            inputController.SetActiveConquer(false);
            marker.SetActive(false);
            tutorialStatus = TutorialFSMStatus.ATTACKWITHFIRE;
            break;

        case TutorialFSMStatus.ATTACKWITHFIRE:
            texts.Add("Te has curado");
            texts.Add("Ahora ya conoces las bases de SLIMERS");
            texts.Add("Explora los diferentes retos para descubrir sus verdaderos límites, si es que los tienen");
            chainTextDialog.SetTextList(texts);
            chainTextDialog.Show();
            chainTextDialog.SetOnClickFunction(() => {
                SceneManager.LoadScene(0);
            });
            inputController.SetActiveInput(false);
            inputController.SetActiveEat(false);
            inputController.SetActiveConquer(false);
            marker.SetActive(false);
            break;
        }
    }