Ejemplo n.º 1
0
    private void generateLevel4()
    {
        eraseMap();
        map = new List <List <int> > {
            new List <int> {
                1, 1, 1, 1, 1
            },
            new List <int> {
                1, 0, 0, 3, 1
            },
            new List <int> {
                1, 0, 1, 1, 1
            },
            new List <int> {
                1, 2, 1, 1, 1
            },
            new List <int> {
                1, 1, 1, 1, 1
            }
        };
        generateMap();

        createEntity(3, 1, Direction.Dir.West, 0);

        List <Action> script = new List <Action>();

        script.Add(ActionManipulator.createAction(Action.ActionType.Wait));
        script.Add(ActionManipulator.createAction(Action.ActionType.Wait));
        script.Add(ActionManipulator.createAction(Action.ActionType.TurnLeft));
        script.Add(ActionManipulator.createAction(Action.ActionType.Wait));
        script.Add(ActionManipulator.createAction(Action.ActionType.Wait));
        script.Add(ActionManipulator.createAction(Action.ActionType.TurnRight));

        GameObject camera = createEntity(1, 1, Direction.Dir.East, 2, script, true);

        camera.GetComponent <DetectRange>().range = 1;

        gameData.dialogMessage.Add("Attention il y a une caméra devant toi ! Par chance son champ de détection est très petit, mais elle te bloque tout de même le passage.");
        gameData.dialogMessage.Add("Il semblerait que cette caméra a une IA, clique dessus pour analyser son comportement pour y trouver une faille et passer. De plus ce modèle de caméra ne semble pas voir en dessous d'elle même.");

        gameData.actionBlocLimit = new List <int>()
        {
            -1, -1, -1, -1, -1, -1
        };
    }
Ejemplo n.º 2
0
    public static bool ContainerToActionList(Action act, GameObject obj)
    {
        bool nonEmpty = false;

        for (int i = 1; i < obj.transform.childCount; i++)
        {
            GameObject child = obj.transform.GetChild(i).gameObject;
            if (child.GetComponent <UIActionType>().type == Action.ActionType.For)
            {
                Action forAct = ActionManipulator.createAction(child.GetComponent <UIActionType>().type);
                forAct.nbFor = int.Parse(child.transform.GetChild(0).transform.GetChild(1).GetComponent <InputField>().text);
                if (forAct.nbFor > 0 && child.transform.childCount > 1 && ContainerToActionList(forAct, child))
                {
                    ActionManipulator.addAction(act, forAct);
                    nonEmpty = true;
                }
            }
            else if (child.GetComponent <UIActionType>().type == Action.ActionType.If)
            {
                Action IfAct = ActionManipulator.createAction(child.GetComponent <UIActionType>().type);
                IfAct.ifEntityType = child.transform.GetChild(0).GetChild(1).GetChild(1).GetComponent <Dropdown>().value;
                IfAct.ifDirection  = child.transform.GetChild(0).GetChild(1).GetChild(2).GetComponent <Dropdown>().value;
                IfAct.range        = int.Parse(child.transform.GetChild(0).GetChild(1).GetChild(3).GetComponent <InputField>().text);
                IfAct.ifNot        = (child.transform.GetChild(0).GetChild(2).GetComponent <Dropdown>().value == 1);
                IfAct.ifValid      = false;
                if (child.transform.childCount > 1 && ContainerToActionList(IfAct, child))
                {
                    ActionManipulator.addAction(act, IfAct);
                    nonEmpty = true;
                }
            }
            else
            {
                ActionManipulator.addAction(act, ActionManipulator.createAction(child.GetComponent <UIActionType>().type));
                nonEmpty = true;
            }
        }
        return(nonEmpty);
    }
Ejemplo n.º 3
0
    //Convert the UI script in a usable script
    public static List <Action> ScriptContainerToActionList(GameObject scriptComposer)
    {
        List <Action> l = new List <Action>();

        for (int i = 0; i < scriptComposer.transform.childCount; i++)
        {
            GameObject child = scriptComposer.transform.GetChild(i).gameObject;
            if (child.GetComponent <UIActionType>().type == Action.ActionType.For)
            {
                Action forAct = ActionManipulator.createAction(child.GetComponent <UIActionType>().type);
                forAct.nbFor = int.Parse(child.transform.GetChild(0).transform.GetChild(1).GetComponent <InputField>().text);
                if (forAct.nbFor > 0 && child.transform.childCount > 1 && ContainerToActionList(forAct, child))
                {
                    l.Add(forAct);
                }
            }
            else if (child.GetComponent <UIActionType>().type == Action.ActionType.If)
            {
                Action IfAct = ActionManipulator.createAction(child.GetComponent <UIActionType>().type);
                IfAct.ifEntityType = child.transform.GetChild(0).GetChild(1).GetChild(1).GetComponent <Dropdown>().value;
                IfAct.ifDirection  = child.transform.GetChild(0).GetChild(1).GetChild(2).GetComponent <Dropdown>().value;
                IfAct.range        = int.Parse(child.transform.GetChild(0).GetChild(1).GetChild(3).GetComponent <InputField>().text);
                IfAct.ifValid      = false;
                IfAct.ifNot        = (child.transform.GetChild(0).GetChild(2).GetComponent <Dropdown>().value == 1);
                if (child.transform.childCount > 1 && ContainerToActionList(IfAct, child))
                {
                    l.Add(IfAct);
                }
            }
            else
            {
                l.Add(ActionManipulator.createAction(child.GetComponent <UIActionType>().type));
            }
        }
        return(l);
    }