Example #1
0
    /// <summary>
    /// 行動キャラ選択
    /// </summary>
    public void ChooseChara()
    {
        m_audio.PlaySe("choose");//se

        Ray        ray = new Ray(FindObjectOfType <RayBox>().transform.gameObject.transform.position, -transform.up);
        RaycastHit hit = new RaycastHit();

        //カーソルの場所になにがあるか
        if (Physics.Raycast(ray, out hit, 1000.0f))
        {
            //プレイヤーだったとき移動開始
            if (hit.collider.tag == "Player")
            {
                //カーソル固定
                FindObjectOfType <RayBox>().move_ = false;

                _nowChooseChar = hit.transform.gameObject;
                _nowChooseChar.GetComponent <Move_System>().Retrieval();

                state_ = State_.move_mode;
            }
            //何もいなかった時メニュー表示
            //else if (hit.collider.tag == "Floor")
            //{
            //    FindObjectOfType<RayBox>().move_ = false;
            //    //FindObjectOfType<MenuManager>().IniMainMenu();
            //    state_ = State_.menu_mode;
            //}
        }
    }
Example #2
0
    //攻撃ボタン用
    public void attackBt()
    {
        if (state_ == State_.action_mode)
        {
            m_audio.PlaySe("choose");
            FindObjectOfType <SubMenuRenderer>().SubMenuStart();//サブメニュー非表示

            //プログラムの問題で遅延
            StartCoroutine(DelayMethod.DelayMethodCall(0.5f, () =>
            {
                state_ = State_.weapon_mode;
            }));
        }
    }
Example #3
0
    /// <summary>
    /// 敵陣ターン終了
    /// </summary>
    public void EnemyTurnEnd()
    {
        _TurnText.color = new Color(0, 0, 255, 255);
        _TurnText.text  = "Player Turn";
        m_audio.PlaySe("TurnStart");

        FindObjectOfType <StatusUI>().setactive(false);

        //演出上の遅延
        StartCoroutine(DelayMethod.DelayMethodCall(waitTime, () =>
        {
            Turn_TextReset();
            FindObjectOfType <RayBox>().move_ = true;
            state_ = State_.simulation_mode;
        }));
    }
Example #4
0
    /// <summary>
    /// 自陣ターン終了
    /// </summary>
    public void TurnEnd()
    {
        if (state_ == State_.enemy_counter_mode || state_ == State_.action_mode || state_ == State_.skill_mode || state_ == State_.item_mode)
        {
            //待機選択時
            if (state_ == State_.action_mode)
            {
                FindObjectOfType <SubMenuRenderer>().SubMenuStart();
            }

            //ステートを変更 & UI表示
            _TurnText.color = new Color(255, 0, 0, 255);
            _TurnText.text  = "Enemy Turn";
            m_audio.PlaySe("TurnStart");
            FindObjectOfType <ExpGage>().Enabled(false);

            //演出上の遅延
            StartCoroutine(DelayMethod.DelayMethodCall(waitTime, () =>
            {
                Turn_TextReset();
                state_ = State_.enemy_turn;
            }));
        }
    }
Example #5
0
	void Update () {
		switch(state){
			case State_.InitPattern:
			m_eventSetCursor = m_pattern.GetEventSet(patternIDX);
			m_time = 0;
			patternIDX = (patternIDX + 1) % m_pattern.GetEventSize();
			state = State_.PlayPattern;
			break;
			
			case State_.PlayPattern:
			m_time += Time.deltaTime;
			List<Event_> eventList = m_eventSetCursor.GetEvents(m_time);
			
			if(m_eventSetCursor.IsEmptyEventList()){
				Debug.Log(string.Format("Next Chunk : {0}", patternIDX));
				m_eventSetCursor.RetoreEventList();
				state = State_.InitPattern;
			}
			
			for(int i = 0; i < eventList.Count; i++){
				MakeEvent(eventList[i]);	
			}
			break;
			
			case State_.End:
			break;
		}
	}
Example #6
0
	void Start () {
		StartCoroutine(InitializeProperties());
		m_time = 0;
		state = State_.InitPattern;
		m_pattern = new Pattern_();
	}
Example #7
0
	void Update () {
		switch(state){
			case State_.Ready:
				gui_ready.Begin();
				state = State_.Ready_Ing;
			break;
			
			case State_.Ready_Ing:
				if(gui_ready.IsEnd)
					state = State_.InitPattern;
			break;
			
			case State_.InitPattern:
			m_eventSetCursor = m_pattern.GetEventSet(patternIDX);
			m_time = 0;
			patternIDX = chunkFlow.getNextChunk();
			state = State_.PlayPattern;
			break;
			
			case State_.PlayPattern:
			float incTime = 0;
			float incRate = 1.0f;
			if(PlayerFish.Instance.FeverTime > 0){
				incRate = PlayerFish.Instance.feverLimit / 2;
				timeCheck = false;
			}
			else if(PlayerFish.Instance.isInvincible){
				if(!timeCheck){
					incTime = -PlayerFish.Instance.invincibleTime;;//-Time.deltaTime; //* PlayerFish.Instance.dx;
					timeCheck = true;
				}
			}
			else{
				timeCheck = false;
			}
			
			m_time += Time.deltaTime * incRate + incTime;//(Time.deltaTime + incTime);
			List<Event_> eventList = m_eventSetCursor.GetEvents(m_time);
			
			if(m_eventSetCursor.IsEmptyEventList()){
				m_eventSetCursor.RetoreEventList();
				state = State_.InitPattern;
			}
			
			for(int i = 0; i < eventList.Count; i++){
				MakeEvent(eventList[i]);	
			}
			break;
			
			case State_.End:
			break;
		}
	}
Example #8
0
	void Start () {
		StartCoroutine(InitializeProperties());
		m_time = 0;
		state = State_.Ready;
		m_pattern = new Pattern_();
		
		chunkFlow = new ChunkFlow();
	}
Example #9
0
	void Update () {
		switch(state){
			case State_.InitPattern:
			m_eventSetCursor = m_pattern.GetEventSet(patternIDX);
			m_time = 0;
			patternIDX = chunkFlow.getNextChunk();/*(patternIDX + 1) % m_pattern.GetEventSize();*/
			state = State_.PlayPattern;
			break;
			
			case State_.PlayPattern:
			m_time += Time.deltaTime;
			List<Event_> eventList = m_eventSetCursor.GetEvents(m_time);
			
			if(m_eventSetCursor.IsEmptyEventList()){
				m_eventSetCursor.RetoreEventList();
				state = State_.InitPattern;
			}
			
			for(int i = 0; i < eventList.Count; i++){
				MakeEvent(eventList[i]);	
			}
			break;
			
			case State_.End:
			break;
		}
	}
Example #10
0
 /// <summary>
 /// 任意のステートに変更
 /// </summary>
 /// <param name="st">State_.name</param>
 public void changeST(State_ st)
 {
     state_ = st;
 }
Example #11
0
 public void moveEnd()
 {
     FindObjectOfType <SubMenuRenderer>().SubMenuStart();
     FindObjectOfType <RayBox>().move_ = false;
     state_ = State_.action_mode;
 }
Example #12
0
    void Update()
    {
        //仮 勝敗判定
        if (!GameObject.FindGameObjectWithTag("Enemy"))
        {
            _TurnText.text = "GameClear!!";
            StartCoroutine(DelayMethod.DelayMethodCall(3.0f, () =>
            {
                SceneManager.LoadScene("Story");
            }));
        }
        else if (!GameObject.FindGameObjectWithTag("Player"))
        {
            _TurnText.text = "GameOver...";
            StartCoroutine(DelayMethod.DelayMethodCall(3.0f, () =>
            {
                SceneManager.LoadScene("GameOver");
            }));
        }

        //遷移
        switch (state_)
        {
        //キャラ選択
        case State_.simulation_mode:

            if ((Input.GetKeyDown(KeyCode.Space) || Input.GetButtonDown("O")) && !Shousai.activeInHierarchy)    //○ボタン予定
            {
                StartCoroutine(DelayMethod.DelayMethodCall(0.1f, () =>
                {
                    ChooseChara();
                }));
            }

            if (Input.GetKeyDown(KeyCode.Alpha9) || Input.GetButtonDown("R1"))
            {
                Ray        serch = new Ray(rayBox.transform.position, -rayBox.transform.up);
                RaycastHit hiton = new RaycastHit();
                //カーソルの下になんかいて
                if (Physics.Raycast(serch, out hiton, 1000.0f))
                {
                    if (hiton.transform.tag == "Player")
                    {
                        Shousai.SetActive(!Shousai.activeInHierarchy);
                        FindObjectOfType <RayBox>().move_ = false;
                        FindObjectOfType <MenuManager>().GetMainControlFlag(true);
                        if (Shousai.activeInHierarchy)
                        {
                            FindObjectOfType <Shosai>()._chara = hiton.transform.gameObject;
                        }
                        else
                        {
                            FindObjectOfType <RayBox>().move_ = true;
                            FindObjectOfType <MenuManager>().GetMainControlFlag(false);
                        }
                    }
                }
            }
            break;

        //キャラがいないマスならメニュー開く(使わない)
        case State_.menu_mode:

            break;

        //移動中
        case State_.move_mode:
            //アニメ再生とか入れる予定
            break;

        //移動後の行動選択
        case State_.action_mode:
            //現状何もなし
            break;

        //武器選択
        case State_.weapon_mode:
            if (!once)
            {
                var items = _nowChooseChar.GetComponent <Character>()._itemprefablist.GetComponent <ItemPrefabList>()._itemprefablist;
                count = 0;
                if (items == null)
                {
                    once   = true;
                    choose = true;
                }
                foreach (var obj in items)
                {
                    if (obj.GetComponent <Weapon>())
                    {
                        GameObject ui = Instantiate(
                            Resources.Load("WeaponUI"),
                            GameObject.Find("Canvas1").transform.Find("Frame").transform) as GameObject;
                        ui.transform.localPosition = new Vector3(0, count * -100, 0);
                        ui.transform.Find("Text").GetComponent <Text>().text = obj.GetComponent <Weapon>()._name;
                        ui.GetComponent <Image>().color = new Color32(170, 170, 170, 170);
                        weapons.Add(obj);
                        weaponUIs.Add(ui);
                        count++;
                    }
                }
                count = 0;
                once  = true;
            }
            if (!choose)
            {
                foreach (var obj in weaponUIs)
                {
                    obj.GetComponent <Image>().color = new Color32(170, 170, 170, 170);
                }
                weaponUIs[count].GetComponent <Image>().color = new Color32(255, 255, 255, 255);

                if (Input.GetAxis("AxisY") == 1 || Input.GetAxis("Vertical") == 1)
                {
                    if (count == 0)
                    {
                        return;
                    }
                    count--;
                }
                if (Input.GetAxis("AxisY") == -1 || Input.GetAxis("Vertical") == -1)
                {
                    if (count == weaponUIs.Count - 1)
                    {
                        return;
                    }
                    count++;
                }
                if (Input.GetButtonDown("O") || Input.GetKeyDown(KeyCode.Space))
                {
                    choose = true;
                }
            }
            else
            {
                foreach (var obj in weaponUIs)
                {
                    obj.SetActive(false);
                }

                _nowChooseChar.GetComponent <Character>().Equipment(weapons[count]);
                choose = false;
                once   = false;
                weapons.Clear();
                weaponUIs.Clear();
                _nowChooseChar.GetComponent <Move_System>().AttackReady();
            }

            break;

        case State_.skill_mode:
            if (!once)
            {
                var skill = _nowChooseChar.GetComponent <Character>()._skillprefablist.GetComponent <SkillPrefabList>()._skillprefablist;
                count = 0;
                if (skill == null)
                {
                    once   = true;
                    choose = true;
                }
                foreach (var obj in skill)
                {
                    if (obj.GetComponent <CommandSkill>())
                    {
                        if (obj.GetComponent <CommandSkill>()._activ)
                        {
                            GameObject ui = Instantiate(
                                Resources.Load("WeaponUI"),
                                GameObject.Find("Canvas1").transform.Find("Frame").transform) as GameObject;
                            ui.transform.localPosition = new Vector3(0, count * -100, 0);
                            ui.transform.Find("Text").GetComponent <Text>().text = obj.GetComponent <CommandSkill>()._name;
                            ui.GetComponent <Image>().color = new Color32(170, 170, 170, 170);
                            weapons.Add(obj);
                            weaponUIs.Add(ui);
                            count++;
                        }
                    }
                }
                count = 0;
                once  = true;
            }
            if (!choose)
            {
                foreach (var obj in weaponUIs)
                {
                    obj.GetComponent <Image>().color = new Color32(170, 170, 170, 170);
                }
                weaponUIs[count].GetComponent <Image>().color = new Color32(255, 255, 255, 255);

                if (Input.GetAxis("AxisY") == 1 || Input.GetAxis("Vertical") == 1)
                {
                    if (count == 0)
                    {
                        return;
                    }
                    count--;
                }
                if (Input.GetAxis("AxisY") == -1 || Input.GetAxis("Vertical") == -1)
                {
                    if (count == weaponUIs.Count - 1)
                    {
                        return;
                    }
                    count++;
                }
                if (Input.GetButtonDown("O") || Input.GetKeyDown(KeyCode.Space))
                {
                    choose = true;
                }
            }
            else
            {
                foreach (var obj in weaponUIs)
                {
                    obj.SetActive(false);
                }

                _nowChooseChar.GetComponent <Character>()._skillprefablist.GetComponent <SkillPrefabList>().SkillEffect(_nowChooseChar, weapons[count]);
                choose = false;
                once   = false;
                weapons.Clear();
                weaponUIs.Clear();
                TurnEnd();
                state_ = State_.stay_mode;
            }
            break;

        //道具選択
        case State_.item_mode:
            if (!once)
            {
                var items = _nowChooseChar.GetComponent <Character>()._itemprefablist.GetComponent <ItemPrefabList>()._itemprefablist;
                count = 0;
                foreach (var obj in items)
                {
                    if (obj.GetComponent <Item>())
                    {
                        GameObject ui = Instantiate(
                            Resources.Load("WeaponUI"),
                            GameObject.Find("Canvas1").transform.Find("Frame").transform) as GameObject;
                        ui.transform.localPosition = new Vector3(0, count * -100, 0);
                        ui.transform.Find("Text").GetComponent <Text>().text = obj.GetComponent <Item>()._name;
                        ui.GetComponent <Image>().color = new Color32(170, 170, 170, 170);
                        weapons.Add(obj);
                        weaponUIs.Add(ui);
                        count++;
                    }
                }
                if (count == 0)
                {
                    Debug.Log("使えるアイテムを持っていません");
                    FindObjectOfType <SubMenuRenderer>().SubMenuStart();
                    choose = false;
                    once   = false;
                    weapons.Clear();
                    weaponUIs.Clear();
                    state_ = State_.action_mode;
                }
                count = 0;
                once  = true;
            }
            if (!choose)
            {
                foreach (var obj in weaponUIs)
                {
                    obj.GetComponent <Image>().color = new Color32(170, 170, 170, 170);
                    weaponUIs[count].GetComponent <Image>().color = new Color32(255, 255, 255, 255);
                }

                if (Input.GetAxis("AxisY") == 1 || Input.GetAxis("Vertical") == 1)
                {
                    if (count == 0)
                    {
                        return;
                    }
                    count--;
                }
                if (Input.GetAxis("AxisY") == -1 || Input.GetAxis("Vertical") == -1)
                {
                    if (count == weaponUIs.Count - 1)
                    {
                        return;
                    }
                    count++;
                }
                if (Input.GetButtonDown("O") || Input.GetKeyDown(KeyCode.Space))
                {
                    choose = true;
                }
            }
            else
            {
                foreach (var obj in weaponUIs)
                {
                    obj.SetActive(false);
                }

                _nowChooseChar.GetComponent <Character>()._itemprefablist.GetComponent <ItemPrefabList>().UseItem(_nowChooseChar, weapons[count]);
                choose = false;
                once   = false;
                weapons.Clear();
                weaponUIs.Clear();
                TurnEnd();
                state_ = State_.stay_mode;
            }
            //仕様未定
            break;

        //待機選択
        case State_.stay_mode:
            //ターン終了

            break;

        //攻撃対象の選択
        case State_.player_attack_mode:

            Ray        ray = new Ray(rayBox.transform.position, -rayBox.transform.up);
            RaycastHit hit = new RaycastHit();
            //カーソルの下になんかいて
            if (Physics.Raycast(ray, out hit, 1000.0f))
            {
                if (hit.transform.tag == "Enemy")
                {
                    FindObjectOfType <StatusUI>().setBattleStatus(
                        _nowChooseChar.GetComponent <Character>()._name,
                        _nowChooseChar.GetComponent <Character>()._totalhp,
                        _nowChooseChar.GetComponent <Character>()._totalMaxhp,
                        _nowChooseChar.GetComponent <Character>()._total_attack,
                        _nowChooseChar.GetComponent <Character>()._hit,
                        _nowChooseChar.GetComponent <Character>()._critical,
                        hit.transform.GetComponent <Character>()._name,
                        hit.transform.GetComponent <Character>()._totalhp,
                        hit.transform.GetComponent <Character>()._totalMaxhp,
                        hit.transform.GetComponent <Character>()._total_attack,
                        hit.transform.GetComponent <Character>()._hit,
                        hit.transform.GetComponent <Character>()._critical);
                }

                //スペース(仮)が押されて && まだ攻撃してないなら
                if ((Input.GetKeyDown(KeyCode.Space) || Input.GetButtonDown("O")) && !attacking)
                {
                    //カーソルがエネミーをさしていたら
                    if (hit.transform.tag == "Enemy")
                    {
                        attacking = true;
                        Debug.Log("自キャラの攻撃!");
                        FindObjectOfType <RayBox>().move_ = false;

                        //とりあえずのエフェクト表示&SE
                        Instantiate(Resources.Load("Eff_Hit_6"), hit.transform.position, Quaternion.identity);
                        m_audio.PlaySe("GunShot");

                        int e_nowhp = hit.transform.GetComponent <Character>()._totalhp;
                        int p_nowhp = _nowChooseChar.GetComponent <Character>()._totalhp;

                        //とりあえずゲージ表示
                        FindObjectOfType <StatusUI>().setactive(true);

                        FindObjectOfType <StatusUI>().setPlayerHpGage(
                            _nowChooseChar.GetComponent <Character>()._totalMaxhp, p_nowhp);
                        FindObjectOfType <StatusUI>().setEnemyHpGage(
                            hit.transform.GetComponent <Character>()._totalMaxhp, e_nowhp);

                        PlayerRedGage.GetComponent <DamageGage>().setdamageGage(
                            _nowChooseChar.GetComponent <Character>()._totalMaxhp, p_nowhp);
                        EnemyRedGage.GetComponent <DamageGage>().setdamageGage(
                            hit.transform.GetComponent <Character>()._totalMaxhp, e_nowhp);

                        //戦闘結果計算
                        FindObjectOfType <BattleManager>().BattleSetup(_nowChooseChar, hit.transform.gameObject);

                        e_dm = e_nowhp - hit.transform.GetComponent <Character>()._totalhp;   //敵ダメージ算出(仮)
                        p_dm = p_nowhp - _nowChooseChar.GetComponent <Character>()._totalhp;  //プレイヤダメージ算出

                        DamegeUIInit(hit.transform.gameObject, e_dm);
                        FindObjectOfType <StatusUI>().setEnemyDamage(e_dm);

                        //攻撃キャラを一時的に保存
                        _nowCounterChara = hit.collider.gameObject;
                        _nowAttackChara  = _nowChooseChar;

                        //結果をUIに渡す
                        FindObjectOfType <StatusUI>().setUnitStatus(
                            hit.collider.GetComponent <Character>()._name,
                            hit.collider.GetComponent <Character>()._totalhp,
                            hit.collider.GetComponent <Character>()._totalMaxhp);

                        //選択キャラの攻撃可能状態を解除
                        _nowChooseChar.GetComponent <Move_System>().AttackRelease();

                        //演出上の間をおいてから敵の反撃へ
                        StartCoroutine(DelayMethod.DelayMethodCall(waitTime, () =>
                        {
                            state_ = State_.enemy_counter_mode;
                        }));
                    }
                    //プレイヤー
                    else if (hit.transform.tag == "Player")
                    {
                        //何もしない
                    }
                    //カーソルがエネミー以外のとこにあると
                    else
                    {
                        Debug.Log("そのマスには何もいません");
                    }
                }
            }

            break;

        case State_.enemy_counter_mode:
            if (attacking)
            {
                Debug.Log("敵の反撃!");
                //とりあえずの反撃エフェクト表示&SE
                Instantiate(Resources.Load("Eff_Hit_6"), _nowAttackChara.transform.position, Quaternion.identity);
                m_audio.PlaySe("GunShot");
                DamegeUIInit(_nowAttackChara, p_dm);

                FindObjectOfType <StatusUI>().setPlayerDamage(p_dm);

                //結果をUIに渡す
                FindObjectOfType <StatusUI>().setUnitStatus(
                    _nowAttackChara.GetComponent <Character>()._name,
                    _nowAttackChara.GetComponent <Character>()._totalhp,
                    _nowAttackChara.GetComponent <Character>()._totalMaxhp);

                //演出上の遅延
                StartCoroutine(DelayMethod.DelayMethodCall(waitTime, () =>
                {
                    TurnEnd();
                }));
                attacking = false;
            }
            break;

        //敵ターン
        case State_.enemy_turn:
            FindObjectOfType <StatusUI>().setactive(false);
            //行動予定エネミーのHPが0なら
            if (_randamEnemy == null)
            {
                //別のエネミーに
                _randamEnemy = GameObject.FindGameObjectWithTag("Enemy");
            }

            //敵が一体でもいれば
            if (_randamEnemy)
            {
                //敵の行動を開始
                _randamEnemy.GetComponent <EnemyBase>().SetNextGoal(_randamEnemy.GetComponent <EnemyBase>().target_square);
                FindObjectOfType <RayBox>().SetCameraPosition(_randamEnemy);
                state_ = State_.enemy_move_mode;
            }
            break;

        //敵の移動
        case State_.enemy_move_mode:
            //敵のアニメーションなどを入れる予定

            break;

        //敵の攻撃
        case State_.enemy_attack_mode:
            //敵のアニメーションなどを入れる予定

            break;

        //プレイヤーの反撃(いらないかも)
        case State_.player_counter_mode:

            break;

        default:
            break;
        }
    }