Beispiel #1
0
    private void TreatCSV()
    {
        currentPos = -1;
        currentStepList.Clear();

        Debug.Log("stringPath=" + "Path/" + pathOfNextCSV);
        Debug.Log(" original path (without Path/) = " + pathOfNextCSV);
        nextCSVToRead = (TextAsset)Resources.Load("Path/" + pathOfNextCSV);
        if (nextCSVToRead == null)
        {
            print("Yep, null");
        }
        Debug.Log("Csv = " + nextCSVToRead.name);

        string[,] grid = CSV_Reader.SplitCsvGrid(nextCSVToRead.text);
        Step bufferStep = null;

        for (uint y = 0; y < grid.GetUpperBound(1); y++)
        {
            Debug.Log("y ?" + y);
            bufferStep = new Step(grid, y);
            currentStepList.Add(bufferStep);
        }
        readingCSV  = true;
        nbrZoneSous = 0;
        zoneSous.Clear();
        displayNextStep();
    }
Beispiel #2
0
    void Start()
    {
#if UNITY_EDITOR
        CSV_Reader __csvReader = GameObject.FindGameObjectWithTag("Ground colliders").GetComponent <CSV_Reader>();
        sbyte[,] __csvMap = __csvReader._GetValues();
        _middle.x         = __csvMap.GetLength(1);
        _middle.y         = __csvMap.GetLength(0);
#else
        _middle.x = CSV_Reader._csv_Reader._csvMap.GetLength(1);
        _middle.y = CSV_Reader._csv_Reader._csvMap.GetLength(0);
#endif
        _middle.x = _middle.x / 2;
        _middle.y = -(_middle.y / 2);

        if (Application.isPlaying)
        {
            _CalculateScales();

            _CreateLayersTrans();

            _AddMarginToParSectAreas();
        }
        else
        {
#if UNITY_EDITOR
            _parallaxScales.RemoveRange(0, _parallaxScales.Count);
            for (int id = 0; id < _backgrounds.Count; id++)
            {
                _parallaxScales.Add(_backgrounds[id].transform.position.z / _limit);
            }
#endif
        }
    }
Beispiel #3
0
    void Start()
    {
        // data = CSV_Reader.Read ("Joint angles1");
        data = CSV_Reader.Read(Config.joint_angles_file_name);

        Hip_RT  = transform.GetChild(1).GetChild(1);
        Hip_LT  = transform.GetChild(1).GetChild(0);
        Knee_RT = transform.GetChild(1).GetChild(1).GetChild(0);
        Knee_LT = transform.GetChild(1).GetChild(0).GetChild(0);
    }
Beispiel #4
0
    void Start()
    {
        // foreach (Transform child in transform)
        //  print("Foreach loop: " + child);
        data = CSV_Reader.Read("Joint angles");
        // for(var i=0; i < data.Count; i++) {
        //     print ("X_angle " + data[i]["Left_Hip_FlexExt"] + " " +
        //            "Y_angle " + data[i]["Left_Hip_AbdAdd"] + " " +
        //            "Z_angle " + data[i]["Left_Hip_IntExt"]);

        // }
        //   foreach (string key in data[0].Keys)
        // {
        //     print(key);
        // }
    }
 // Use this for initialization
 void Start()
 {
     if (csv_reader == null)
     {
         csv_reader = this.GetComponent <CSV_Reader>();
     }
     if (ui_holder == null)
     {
         ui_holder = this.GetComponent <UI_Holder>();//oula nope
     }
     if (scenario == null)
     {
         scenario = this.GetComponent <Scenario>();
     }
     if (sonMaster == null)
     {
         sonMaster = this.GetComponent <SonMaster>();
     }
 }
    // Disable Field Unused warning
#pragma warning disable 0414

    // Works with regular fields
    // [DebugGUIGraph(min: -1, max: 1, r: 0, g: 1, b: 0, autoScale: true)]
    // float MomentumX;

    // As well as properties
    // [DebugGUIGraph(min: -1, max: 1, r: 0, g: 1, b: 1, autoScale: true)]
    // float CosProperty { get { return Mathf.Cos(Time.time * 6); } }

#if NET_4_6
    // Also works for expression-bodied properties in .Net 4.6+
    // [DebugGUIGraph(min: -1, max: 1, r: 1, g: 0.3f, b: 1)]
    // float SinProperty => Mathf.Sin((Time.time + Mathf.PI / 2) * 6);
#else
    // [DebugGUIGraph(min: -1, max: 1, r: 1, g: 0.5f, b: 1)]
    // float SinProperty { get { return Mathf.Sin((Time.time + Mathf.PI / 2) * 6); } }
#endif

    // User inputs, print and graph in one!
    // [DebugGUIGraph(group: 1, r: 1, g: 0.3f, b: 0.3f)]
    // float MomentumY;
    // [DebugGUIPrint, DebugGUIGraph(group: 1, r: 0, g: 1, b: 0)]
    // float mouseY;

    void Awake()
    {
        // Log (as opposed to LogPersistent) will disappear automatically after some time.
        // DebugGUI.Log("Hello! I will disappear in five seconds!");

        //find your dropdown object
        print("Graph Created");



        data  = CSV_Reader.Read("chathu_trial_Session10_Shimmer_5F42_Calibrated_PC");
        data2 = CSV_Reader.Read(Config.joint_angles_file_name);

        // for(var i=0; i < data.Count; i++) {
        //     print ("X_acc " + data[i]["Shimmer_5F42_Accel_WR_X_CAL"] + " " +
        //            "Y_acc " + data[i]["Shimmer_5F42_Accel_WR_X_CAL"] + " " +
        //            "Z_acc " + data[i]["Shimmer_5F42_Accel_WR_X_CAL"]);

        // }
    }
Beispiel #7
0
    private void Awake()
    {
        instance = this;

        /*
         * if(instance == null)         // 씬이 바뀌어도 유지
         * {
         *  instance = this;
         *  DontDestroyOnLoad(this.gameObject);
         * }
         * else
         *  Destroy(this.gameObject);
         */

        item_list = CSV_Reader.Read("Item_Table"); // 아이탬 로드
        for (int i = 0; i < item_list.Count; i++)
        {
            item_num.Add(item_list[i]["name"], 0); // 먹은 아이템 갯수에 아이템 이름 등록
        }

        combination_list = CSV_Reader.Read("Combination_Table"); // 조합 로드

        quest_list = CSV_Reader.Read("Quest_Table");             // 퀘스트 로드
        for (int i = 0; i < quest_list.Count; i++)
        {
            quest_state.Add(i + 1, 0); // 퀘스트 진행상태 등록
        }

        world_list = CSV_Reader.Read("World_Table"); // 지역 방사능 로드

        if (SceneManager.GetActiveScene().name == "Game_SceneNew")
        {
            dictionary_sc.before_awake();
        }

        audioSource = gameObject.AddComponent <AudioSource>();
    }
Beispiel #8
0
    public void LoadCSV()
    {
        stepList.Clear();
        if (pathToTreat == "")
        {
        }
        else
        {
            //Here go the real code :
            Debug.Log(" original path (without Path/) = " + pathToTreat);
            nextCSVToRead = (TextAsset)Resources.Load("Path/" + pathToTreat);
            if (nextCSVToRead == null)
            {
                Debug.Log("Yep, null : " + pathToTreat);
            }
            Debug.Log("Csv = " + nextCSVToRead.name);

            string[,] grid = CSV_Reader.SplitCsvGrid(nextCSVToRead.text);
            Step bufferStep = null;
            for (uint y = 0; y < grid.GetUpperBound(1); y++)
            {
                Debug.Log("y ?" + y);
                bufferStep = new Step(grid, y);
                stepList.Add(bufferStep);
            }

            //TO DO : second pass to remplace string to int ? like for each room ?
            foreach (Step s in stepList)
            {
                switch (s.type)
                {
                case Utils.StepType.ChangeZone:
                    if (s.grid[1, s.y] == "" || s.grid[1, s.y] == null)
                    {
                        s.grid[1, s.y] = (0).ToString();
                        if (s.grid[2, s.y] == "" || s.grid[2, s.y] == null)
                        {
                            s.grid[1, s.y] = (0).ToString();
                        }
                    }
                    else
                    {
                        int res = roomsName.IndexOf(s.grid[1, s.y]);
                        s.grid[1, s.y] = res.ToString();
                        if (res == -1)
                        {
                            Debug.LogError(s.grid[1, s.y] + " is not a room id");
                        }
                        else
                        {
                            res            = zoneName[res].IndexOf(s.grid[2, s.y]);
                            s.grid[2, s.y] = res.ToString();
                            if (res == -1)
                            {
                                Debug.LogError(s.grid[2, s.y] + " is not a zone id");
                            }
                        }
                    }
                    //s.grid[3, s.y] == true.ToString()) ? true.ToString() : false.ToString(); //Active or not
                    break;

                case Utils.StepType.ChangeInteraction:
                    if (s.grid[1, s.y] == "" || s.grid[1, s.y] == null)
                    {
                        s.grid[1, s.y] = (0).ToString();
                        if (s.grid[2, s.y] == "" || s.grid[2, s.y] == null)
                        {
                            s.grid[1, s.y] = (0).ToString();
                        }
                        if (s.grid[3, s.y] == "" || s.grid[3, s.y] == null)
                        {
                            s.grid[3, s.y] = (0).ToString();
                        }
                    }
                    else
                    {
                        int res = roomsName.IndexOf(s.grid[1, s.y]);
                        s.grid[1, s.y] = res.ToString();
                        if (res == -1)
                        {
                            Debug.LogError(s.grid[1, s.y] + " is not a room id");
                        }
                        else
                        {
                            int res2 = zoneName[res].IndexOf(s.grid[2, s.y]);
                            s.grid[2, s.y] = res2.ToString();
                            if (res2 == -1)
                            {
                                Debug.LogError(s.grid[2, s.y] + " is not a zone id");
                            }
                            else
                            {
                                res            = interName[res][res2].IndexOf(s.grid[3, s.y]);
                                s.grid[3, s.y] = res.ToString();
                                if (res == -1)
                                {
                                    Debug.LogError(s.grid[3, s.y] + " is not an interaction id");
                                }
                            }
                        }
                    }
                    break;

                case Utils.StepType.ChangeState:
                    if (s.grid[1, s.y] == "" || s.grid[1, s.y] == null)
                    {
                        s.grid[1, s.y] = (0).ToString();
                        if (s.grid[2, s.y] == "" || s.grid[2, s.y] == null)
                        {
                            s.grid[1, s.y] = (0).ToString();
                        }
                        if (s.grid[3, s.y] == "" || s.grid[3, s.y] == null)
                        {
                            s.grid[3, s.y] = (0).ToString();
                        }
                    }
                    else
                    {
                        int res = roomsName.IndexOf(s.grid[1, s.y]);
                        s.grid[1, s.y] = res.ToString();
                        if (res == -1)
                        {
                            Debug.LogError(s.grid[1, s.y] + " is not a room id");
                        }
                        else
                        {
                            int res2 = zoneName[res].IndexOf(s.grid[2, s.y]);
                            s.grid[2, s.y] = res2.ToString();
                            if (res2 == -1)
                            {
                                Debug.LogError(s.grid[2, s.y] + " is not a zone id");
                            }
                            else
                            {
                                //
                                int res3 = -1;
                                for (int i = 0; i < statesName[res][res2].Length; i++)
                                {
                                    if (s.grid[3, s.y] == statesName[res][res2][i])
                                    {
                                        res3 = i;
                                    }
                                }
                                //
                                s.grid[3, s.y] = res3.ToString();
                                if (res3 == -1)
                                {
                                    Debug.LogError(s.grid[3, s.y] + " is not a state");
                                }
                            }
                        }
                    }
                    break;

                case Utils.StepType.Salle:
                    if (s.grid[1, s.y] == "" || s.grid[1, s.y] == null)
                    {
                        s.grid[1, s.y] = (0).ToString();
                    }
                    else
                    {
                        int res = roomsName.IndexOf(s.grid[1, s.y]);
                        if (res == -1)
                        {
                            Debug.LogError(s.grid[1, s.y] + " is not a room id");
                        }
                        s.grid[1, s.y] = res.ToString();
                    }
                    break;

                case Utils.StepType.Bruitage:
                    break;

                case Utils.StepType.Musique:
                    break;

                case Utils.StepType.Next:
                    //CSV path
                    break;

                case Utils.StepType.Condition:
                    //
                    //CSV path to win
                    //CSV path to not
                    break;

                case Utils.StepType.Animation:
                    int indexAnimator = AnimationHandler.animatorsName.IndexOf(s.grid[1, s.y]);
                    s.grid[1, s.y] = indexAnimator.ToString();
                    if (indexAnimator == -1)
                    {
                        Debug.Log("Animator " + s.grid[1, s.y] + " doesn't exist");
                    }
                    else
                    {
                        if (s.grid[2, s.y] == true.ToString())
                        {
                            indexAnimator  = triggerPerAnimator[indexAnimator].IndexOf(s.grid[3, s.y]);
                            s.grid[3, s.y] = indexAnimator.ToString();
                            if (indexAnimator == -1)
                            {
                                Debug.Log(s.grid[1, s.y] + "'s animator doesn't have a trigger named : " + s.grid[3, s.y]);
                            }
                        }
                        else
                        {
                            indexAnimator  = triggerPerAnimator[indexAnimator].IndexOf(s.grid[3, s.y]);
                            s.grid[3, s.y] = indexAnimator.ToString();
                            if (indexAnimator == -1)
                            {
                                Debug.Log(s.grid[1, s.y] + "'s animator doesn't have a trigger named : " + s.grid[3, s.y]);
                            }
                            //s.grid 4 doesn't change
                        }
                    }
                    break;

                case Utils.StepType.NextLine:
                case Utils.StepType.ConditionLine:
                case Utils.StepType.Decor:     //maybe like animation
                case Utils.StepType.Description:
                case Utils.StepType.AddItem:
                case Utils.StepType.RemoveItem:
                case Utils.StepType.CinematicBar:
                default:
                    break;
                }
            }
        }
    }
Beispiel #9
0
 void Start()
 {
     data       = CSV_Reader.Read("chathu_trial_Session10_Shimmer_5F42_Calibrated_PC");
     num_points = data.Count;
 }
Beispiel #10
0
 private void Awake()
 {
     TextList = CSV_Reader.Read("Text");
 }