Пример #1
0
    void Start()
    {
        map_ctr = map.GetComponent <Map_Control>();
        Vector3 exit_tile_pos = map_ctr.map_tiles[currentPos].transform.position;

        transform.position = new Vector3(exit_tile_pos.x, exit_tile_pos.y + 0.5f, exit_tile_pos.z - 1.0f);
    }
Пример #2
0
    // UI codes which should not be here
    //   public GameObject Enemy_info_HUD;
    //public GameObject Char_detailed_info_hud;
    //   Text _enemy_name;
    //Text _char_detail_info;

    // Use this for initialization
    void Start()
    {
        _fire_cd = fire_cd;
        map_ctr  = map_tiles.GetComponent <Map_Control>();
        turn_ctr = turn_control.GetComponent <Turn_Control>();

        KeyValuePair <float, float> XYpos = new KeyValuePair <float, float>(currentPos % map_ctr.map_size,
                                                                            currentPos / map_ctr.map_size);

        transform.position = new Vector3(-5f + XYpos.Key * 0.5f + XYpos.Value * 0.5f,
                                         0 + XYpos.Key * (0.25f) + XYpos.Value * (-0.25f),
                                         0 + XYpos.Key * (0.01f) + XYpos.Value * (-0.01f));

        //GameObject IngameUI = turn_ctr.UI.gameObject;

        //GameObject MoveOver_Char_info = IngameUI.gameObject.transform.FindChild


        //      GameObject selected_Enemy_name = Enemy_info_HUD.transform.Find("Enemy_avatar_back/Text").gameObject;
        //      _enemy_name = selected_Enemy_name.GetComponent<Text>();
        //      Enemy_info_HUD.SetActive(false);

        //GameObject Mouse_over_Char_name = Char_detailed_info_hud.transform.Find("Char_avatar_back/Text").gameObject;
        //_char_detail_info = Mouse_over_Char_name.GetComponent<Text>();
        //Char_detailed_info_hud.SetActive(false);

        UI_ctr = turn_control.GetComponent <Turn_Control>().UI.GetComponent <InGameUI>();
    }
Пример #3
0
    // Use this for initialization
    void Start()
    {
        gameRound = "Player";

        //debug
        Debug.Log("turn: " + gameRound);


        map_ctr = map.GetComponent <Map_Control>();
        UI_ctr  = UI.GetComponent <InGameUI>();
    }
Пример #4
0
    // Use this for initialization
    void Start()
    {
        GameObject controller = GameObject.Find("map_tiles");                            //get reference of GameController

        mc = controller.GetComponent <Map_Control>();                                    //same as above

        mc.units_state[currentPos] = gameObject;
        mapInfo = mc.map_tiles;                                                          //get map info from GameController
        Vector3 xyPosition = mapInfo[currentPos].transform.position;

        transform.position = new Vector3(xyPosition.x, xyPosition.y + 0.6f, xyPosition.z - 1.0f);
    }
Пример #5
0
    public void fire_move()
    {
        GameObject map = GameObject.Find("map_tiles");

        mc = map.GetComponent <Map_Control>();
        Vector3 xyPosition = mc.map_tiles[pos].transform.position;

        des = new Vector3(xyPosition.x, xyPosition.y + 0.7f, xyPosition.z - 1.0f);

        fire_moving = true;


        //iTween.MoveTo(gameObject, des, 2);
    }
Пример #6
0
    // Use this for initialization
    void Start()
    {
        DialogueManager.gameObject.SetActive(true);

        dm = DialogueManager.GetComponent <DialogueManager>();
        mc = MapController.GetComponent <Map_Control>();
        tc = TurnController.GetComponent <Turn_Control>();
        ui = InGameUI.GetComponent <InGameUI>();

        prev_turn_count = 1;
        curt_turn_count = mc.turn_count;

        //if (Level == 1)
        //{
        //    InGameHUD = InGameUI.transform.GetChild(4).gameObject;
        //    InGameHUD.transform.GetChild(0).gameObject.SetActive(false);
        //    InGameHUD.transform.GetChild(1).gameObject.SetActive(false);
        //    InGameHUD.transform.GetChild(2).gameObject.SetActive(false);
        //}
    }
Пример #7
0
    List <int> enemyBlockPos = new List <int>();   //for exit



    // Use this for initialization

    void Awake()
    {
        map     = Instantiate(map_prefab);
        UI      = Instantiate(UI_prefab);
        Turn    = Instantiate(Turn_prefab);
        WLcheck = Instantiate(WLcheck_prefab);

        _rdsGeneEnemy = rdsGeneEnemy;


        //LevelManager = Instantiate(LevelManager_prefab);
        //Dialogue = Instantiate(Dialogue_prefab);
        //Dialogue.transform.SetParent(UI.transform);
        //Dialogue.GetComponent<RectTransform>().anchoredPosition = new Vector2(0, 0);
        //Debug.Log(UI.GetComponent<RectTransform>().rect);
        //Dialogue.transform.GetChild(0).gameObject.GetComponent<RectTransform>().rect.Set(0,0,UI.GetComponent<Rect>().width,
        //UI.GetComponent<Rect>().height);
        //for (int i = 0; i < Dialogue.transform.childCount;++i)
        //Dialogue.transform.GetChild(0).GetComponent<RectTransform>().sizeDelta = new Vector2(UI.GetComponent<RectTransform>().rect.width,UI.GetComponent<RectTransform>().rect.height);
        //Dialogue.transform.localScale = new Vector3(1, 1, 1);

        map_ctr     = map.GetComponent <Map_Control>();
        UI_ctr      = UI.GetComponent <InGameUI>();
        Turn_ctr    = Turn.GetComponent <Turn_Control>();
        WLcheck_ctr = WLcheck.GetComponent <WinLoseCheck>();
        //level_ctr = LevelManager.GetComponent<LevelManager>();
        //dialogue_ctr = Dialogue.GetComponent<DialogueManager>();

        //director = timeline.GetComponent<PlayableDirector>();
        //PlayableAsset playable = director.playableAsset;
        //TimelineAsset timelineAsset = (TimelineAsset)playable;
        //TrackAsset UItrack = timelineAsset.GetOutputTrack(6);
        //director.SetGenericBinding(UItrack, UI);
        //director.Play();

        LevelStart();



        UI.SetActive(false);
    }
Пример #8
0
    // Use this for initialization
    void Start()
    {
        map_ctr = map.GetComponent <Map_Control>();
        //List<Gameobject_Position_prefab> Character_Generate_Info = WorldGenerator.GetComponent<WorldGenerator>().characters_prefab

        Button Attack_btn = Attackbtn.GetComponent <Button>();

        Attack_btn.onClick.AddListener(() => map_ctr.Character_Attack());

        Button Pick_btn = Pickbtn.GetComponent <Button>();

        Pick_btn.onClick.AddListener(() => map_ctr.Character_PickUp());

        Button Skill_btn = Skillbtn.GetComponent <Button>();

        Skillbtn.onClick.AddListener(() => map_ctr.Character_Skill());

        Button _exit = exit.GetComponent <Button>();

        _exit.onClick.AddListener(exit_on_click);

        GameObject Move_Over_Avatar_Info = MouseOver_Char_info.transform.Find("Char_avatar_back").Find("Char_avatar").gameObject;

        Move_Over_Avatar = Move_Over_Avatar_Info.GetComponent <Image>();
        GameObject Move_Over_Avatar_Name_Info = MouseOver_Char_info.transform.Find("Char_avatar_back").Find("name").gameObject;

        Move_Over_Text = Move_Over_Avatar_Name_Info.GetComponent <Text>();

        GameObject Move_Over_Char_Skill_Info = MouseOver_Char_Skill_info.transform.Find("Char_avatar_back").gameObject;

        Move_Over_Char_Skill = Move_Over_Char_Skill_Info.GetComponent <Image>();

        GameObject MouseOver_Tile_Info_1 = MouseOver_Tile_Info.transform.Find("Image").gameObject;

        Move_Over_Tile = MouseOver_Tile_Info_1.GetComponent <Image>();

        GameObject MouseOver_Tile_Info_2 = MouseOver_Tile_Info.transform.Find("Tile_name").gameObject;

        Move_Over_Tile_Name = MouseOver_Tile_Info_2.GetComponent <Text>();

        GameObject Enemy_Information = Enemy_Info.transform.Find("Enemy_num").gameObject;

        Enemy_Num = Enemy_Information.GetComponent <Text>();

        GameObject Round_Information = Round_Info.transform.Find("round_remain").gameObject;

        Next_WAVE_Round = Round_Information.GetComponent <Text>();

        wave_num  = wave_info.transform.Find("wave").gameObject.GetComponent <Text>();
        score_num = score_info.transform.Find("score").gameObject.GetComponent <Text>();

        UI_WAVE.SetActive(false);

        for (int i = 0; i < 4; i++)
        {
            Char_infos[i].SetActive(false);
        }

        if (Available_Char_info_slot_num != 0)
        {
            for (int i = 0; i < 4; i++)
            {
                if (i + 1 > Characters_clone.Count)
                {
                    break;
                }

                GameObject Char_Avatar     = Char_infos[i].transform.Find("Char_avatar_back").Find("Char_avatar").gameObject;
                GameObject Char_Health     = Char_infos[i].transform.Find("Char_Health_bar").Find("Health_number").gameObject;
                GameObject Char_Health_bar = Char_infos[i].transform.Find("Char_Health_bar").Find("Health_FILLImage").gameObject;
                GameObject Char_Move_num   = Char_infos[i].transform.Find("Char_Move").Find("Move_range").gameObject;
                GameObject Char_Attack     = Char_infos[i].transform.Find("Char_Attack").Find("Attack_Damage").gameObject;

                Char_avatar   = Char_Avatar.GetComponent <Image>();
                Health_number = Char_Health.GetComponent <Text>();
                Char_Move     = Char_Move_num.GetComponent <Text>();
                Char_attack   = Char_Attack.GetComponent <Text>();
                healthfill    = Char_Health_bar.GetComponent <Image>();

                if (Characters_clone[i].name == "Monk(Clone)")
                {
                    Char_infos[i].SetActive(true);
                    Health_number.text = ((Characters_clone[i].GetComponent <Monk>().current_health).ToString() + "/" +
                                          (Characters_clone[i].GetComponent <Monk>().health).ToString());
                    healthfill.fillAmount = ((Characters_clone[i].GetComponent <Monk>().current_health) /
                                             (Characters_clone[i].GetComponent <Monk>().health));
                    Char_attack.text             = (Characters_clone[i].GetComponent <Monk>().attack_damage).ToString();
                    Char_Move.text               = (Characters_clone[i].GetComponent <Monk>().dmgUp_by_skill).ToString();
                    Char_avatar.sprite           = Monk;
                    char_info_slots_dict["Monk"] = i;
                }

                if (Characters_clone[i].name == "Makepinggo(Clone)")
                {
                    Char_infos[i].SetActive(true);
                    Health_number.text = ((Characters_clone[i].GetComponent <Makepinggo>().current_health).ToString() + "/" +
                                          (Characters_clone[i].GetComponent <Makepinggo>().health).ToString());
                    healthfill.fillAmount = ((Characters_clone[i].GetComponent <Makepinggo>().current_health) /
                                             (Characters_clone[i].GetComponent <Makepinggo>().health));
                    Char_attack.text   = (Characters_clone[i].GetComponent <Makepinggo>().attack_damage).ToString();
                    Char_Move.text     = (Characters_clone[i].GetComponent <Makepinggo>().skill_damage).ToString();
                    Char_avatar.sprite = Makepinggo;
                    char_info_slots_dict["Makepinggo"] = i;
                }
                else if (Characters_clone[i].name == "Tauren(Clone)")
                {
                    Char_infos[i].SetActive(true);
                    Health_number.text = ((Characters_clone[i].GetComponent <Tauren>().current_health).ToString() + "/" +
                                          (Characters_clone[i].GetComponent <Tauren>().health).ToString());
                    healthfill.fillAmount = ((Characters_clone[i].GetComponent <Tauren>().current_health) /
                                             (Characters_clone[i].GetComponent <Tauren>().health));
                    Char_attack.text               = (Characters_clone[i].GetComponent <Tauren>().attack_damage).ToString();
                    Char_Move.text                 = (Characters_clone[i].GetComponent <Tauren>().skill_damage).ToString();
                    Char_avatar.sprite             = Tauren;
                    char_info_slots_dict["Tauren"] = i;
                }
                else if (Characters_clone[i].name == "Archer(Clone)")
                {
                    Char_infos[i].SetActive(true);
                    Health_number.text = ((Characters_clone[i].GetComponent <Archer>().current_health).ToString() + "/" +
                                          (Characters_clone[i].GetComponent <Archer>().health).ToString());
                    healthfill.fillAmount = ((Characters_clone[i].GetComponent <Archer>().current_health) /
                                             (Characters_clone[i].GetComponent <Archer>().health));
                    Char_attack.text               = (Characters_clone[i].GetComponent <Archer>().attack_damage).ToString();
                    Char_Move.text                 = (Characters_clone[i].GetComponent <Archer>().skill_damage).ToString();
                    Char_avatar.sprite             = Archer;
                    char_info_slots_dict["Archer"] = i;
                }
                else if (Characters_clone[i].name == "Wuchang(Clone)")
                {
                    Char_infos[i].SetActive(true);
                    Health_number.text = ((Characters_clone[i].GetComponent <Wuchang>().current_health).ToString() + "/" +
                                          (Characters_clone[i].GetComponent <Wuchang>().health).ToString());
                    healthfill.fillAmount = ((Characters_clone[i].GetComponent <Wuchang>().current_health) /
                                             (Characters_clone[i].GetComponent <Wuchang>().health));
                    Char_attack.text   = (Characters_clone[i].GetComponent <Wuchang>().attack_damage).ToString();
                    Char_Move.text     = (Characters_clone[i].GetComponent <Wuchang>().skill_damage).ToString();
                    Char_avatar.sprite = Wuchang;
                    char_info_slots_dict["Wuchang"] = i;
                }
                else if (Characters_clone[i].name == "SwordMan(Clone)")
                {
                    Char_infos[i].SetActive(true);
                    Health_number.text = ((Characters_clone[i].GetComponent <SwordMan>().current_health).ToString() + "/" +
                                          (Characters_clone[i].GetComponent <SwordMan>().health).ToString());
                    healthfill.fillAmount = ((Characters_clone[i].GetComponent <SwordMan>().current_health) /
                                             (Characters_clone[i].GetComponent <SwordMan>().health));
                    Char_attack.text   = (Characters_clone[i].GetComponent <SwordMan>().attack_damage).ToString();
                    Char_Move.text     = (Characters_clone[i].GetComponent <SwordMan>().skill_damage).ToString();
                    Char_avatar.sprite = SwordMan;
                    char_info_slots_dict["SwordMan"] = i;
                }
                Available_Char_info_slot_num -= 1;
            }
        }
    }