Exemple #1
0
    override public void Excute(PlayerRoot pr = null)
    {
        #region マウス操作
        if (Input.GetMouseButtonDown(0))
        {
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit = new RaycastHit();
            if (Physics.Raycast(ray, out hit, Mathf.Infinity, d_layerMask))
            {
                switch (hit.collider.gameObject.layer)
                {
                case 8:     //Player
                    if (hit.collider.gameObject.GetComponent <JobBase>()._type == JobType.Leader)
                    {
                        if (hit.collider.gameObject.GetComponent <JobBase>().controller == ReadyMode.Instance)
                        {
                            if (!isBtnShow)
                            {           //ボタンはまだ生成していない
                                pr.p_jb = hit.collider.gameObject.GetComponent <JobBase>();
                                if (pr.p_jb.CanTakeAction())
                                {
                                    pr.p_jb.ShowSkillBtn();
                                    isBtnShow = true;
                                }
                            }
                            // すでに生成したら
                            else
                            {
                                pr.p_jb.HideSkillBtn();
                                pr.p_jb = hit.collider.gameObject.GetComponent <JobBase>();
                                pr.p_jb.ShowSkillBtn();
                            }
                        }
                    }
                    break;

                case 14:     //Yousei
                    if (hit.collider.gameObject.GetComponent <SkillScript>().s_name == "癒しの精霊")
                    {
                        TutorialRoot.Instance.msg = "緑色の精霊をノエルにドラッグ!」";
                        pr.p_jb     = hit.collider.gameObject.GetComponentInParent <JobBase>();
                        pr.btn      = hit.collider.gameObject;
                        pr.s_script = pr.btn.GetComponent <SkillScript>();
                        pr.ChangeMode(t_targetMode.Instance);
                    }
                    break;
                }
            }
        }
        if (Input.GetMouseButtonDown(1))
        {
            pr.p_jb.HideSkillBtn();
        }
        #endregion
    }
Exemple #2
0
 /// <summary>
 /// スキルを使う
 /// </summary>
 /// <param name="pr">PlayerRoot.</param>
 /// <param name="target">Target.</param>
 /// <param name="btn">Skill Button.</param>
 /// <param name="effectTime">Effect time.</param>
 private void SkillUse(PlayerRoot pr, GameObject target, GameObject btn, float effectTime = 0)
 {
     GameObject.FindGameObjectWithTag("PartyRoot").GetComponent <PartyRoot>().attackList.Add(pr.p_jb.gameObject);
     if (btn.GetComponentInParent <JobBase>()._type == JobType.Leader)
     {
         btn.GetComponentInParent <JobBase>().HideKirenBtn();
     }
     pr.p_jb.ChangeMode(SkillMode.Instance);
     pr.p_jb._target = target; pr.p_jb.skillUsing = pr.s_script;
     pr.ChangeMode(BattelMode.Instance);
 }
Exemple #3
0
    override public void Excute(PlayerRoot pr = null)
    {
        #region マウス操作
        if (Input.GetMouseButtonDown(0))
        {
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit = new RaycastHit();
            if (Physics.Raycast(ray, out hit, Mathf.Infinity, d_layerMask))
            {
                switch (hit.collider.gameObject.layer)
                {
                case 8:     //Player
                    if (hit.collider.gameObject.GetComponent <JobBase>()._type == JobType.Attacker)
                    {
                        if (hit.collider.gameObject.GetComponent <JobBase>().controller == ReadyMode.Instance)
                        {
                            if (!isBtnShow)
                            {           //ボタンはまだ生成していない
                                pr.p_jb = hit.collider.gameObject.GetComponent <JobBase>();
                                if (pr.p_jb.CanTakeAction())
                                {
                                    TutorialRoot.Instance.msg = "スラッシュを魔物までドラッグ!」";
                                    pr.p_jb.ShowSkillBtn();
                                    isBtnShow = true;
                                }
                            }
                        }
                    }
                    break;

                case 10:     //Command
                    if (isBtnShow)
                    {        // ボタンを選択したら
                        // 選択したボタンを保管
                        Debug.Log(hit.collider.gameObject.GetComponent <SkillScript>().s_name);
                        if (hit.collider.gameObject.GetComponent <SkillScript>().s_name == "スラッシュ")
                        {
                            pr.btn      = hit.collider.gameObject;
                            pr.s_script = pr.btn.GetComponent <SkillScript>();
                            pr.ChangeMode(t_targetMode.Instance);
                        }
                    }
                    break;
                }
            }
        }
        #endregion
    }
Exemple #4
0
 void OnControllerColliderHit(ControllerColliderHit other)
 {
     if (this.battelStatus == BattelStatus.NOT_IN_BATTEL)
     {
         GameObject other_go = other.gameObject;
         // モンスターを接触したら
         if (other_go.layer == LayerMask.NameToLayer("Enemy"))
         {
             PlayerRoot pr = PlayerRoot.Instance;
             pr.ChangeMode(T_Wait.Instance);
             pr.p_jb._target = other_go;
             if (other_go.GetComponentInParent <EnemyPoint>().battelEnemyList.Count > 0)
             {
                 pr.battelEnemyList = other_go.GetComponentInParent <EnemyPoint>().battelEnemyList;
             }
             FadeManager.Instance.LoadLevel("BattelScene", 2, BattelStart.Instance);
             pr.transform.position = this.transform.position;
             pr.transform.rotation = this.transform.rotation;
             other_go.transform.GetComponentInParent <EnemyPoint>().isEnemyDead = true;
             Destroy(other_go);
         }
     }
 }
Exemple #5
0
    override public void Excute(PlayerRoot pr = null)
    {
        // ボタンがなければ
        if (pr.btn == null)
        {
            pr.ChangeMode(BattelMode.Instance);
        }
        #region マウス操作
        if (Input.GetMouseButtonDown(0))
        {
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit = new RaycastHit();
            if (Physics.Raycast(ray, out hit, Mathf.Infinity, d_layerMask))
            {
                switch (hit.collider.gameObject.layer)
                {
                case 8:     //Player
                    pr.p_jb.HideSkillBtn();
                    pr.p_jb = hit.collider.gameObject.GetComponent <JobBase>();
                    pr.p_jb.ShowSkillBtn();
                    pr.ChangeMode(BattelMode.Instance);
                    break;

                case 10:     //Command
                    // 選択したボタンを保管
                    pr.btn      = hit.collider.gameObject;
                    pr.s_script = pr.btn.GetComponent <SkillScript>();
                    btnTempPos  = pr.btn.transform.localPosition;
                    break;

                case 14:     //Yousei
                    // 選択したボタンを保管
                    pr.p_jb.HideSkillBtn();
                    pr.p_jb     = hit.collider.gameObject.GetComponentInParent <JobBase>();
                    pr.btn      = hit.collider.gameObject;
                    pr.s_script = pr.btn.GetComponent <SkillScript>();
                    btnTempPos  = pr.btn.transform.localPosition;
                    break;
                }
            }
        }
        if (Input.GetMouseButton(0))
        {
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit = new RaycastHit();
            if (Physics.Raycast(ray, out hit, Mathf.Infinity, layerMask))
            {
                Debug.Log(hit.collider.gameObject.name);
                if (pr.btn != null)
                {
                    // ボタンを動かす
                    Vector3 pos = hit.point;
                    if (hit.collider.gameObject.layer == LayerMask.NameToLayer("Ground"))
                    {
                        pos.y += 0.2f;
                    }
                    pr.btn.transform.position = pos;
                }
            }
        }
        if (Input.GetMouseButtonUp(0))
        {
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit = new RaycastHit();
            if (Physics.Raycast(ray, out hit, Mathf.Infinity, u_layerMask))
            {
                if (pr.btn != null)
                {
                    if (pr.s_script.s_targetNum != TargetNum.SELF)
                    {
                        //レイヤーが同じなら
                        if (hit.collider.gameObject.layer != LayerMask.NameToLayer("Ground"))
                        {
                            SkillUse(pr, hit.collider.gameObject, pr.btn, pr.s_script.s_effectTime);
                        }
                        else//ボタンを初期位置に戻す
                        {
                            pr.StartCoroutine(pr.LerpMove(pr.btn,
                                                          pr.btn.transform.localPosition, btnTempPos, 1));
                        }
                    }
                    // SELFなら、即発動
                    else
                    {
                        SkillUse(pr, pr.p_jb.gameObject, pr.btn, pr.s_script.s_effectTime);
                    }
                }
            }
            else//ボタンを初期位置に戻す
            {
                pr.StartCoroutine(pr.LerpMove(pr.btn,
                                              pr.btn.transform.localPosition, btnTempPos, 1));
            }
        }
        if (Input.GetMouseButtonDown(1))
        {
            pr.ChangeMode(BattelMode.Instance);
        }
        #endregion
        pr.CheckEndBattel();
        pr.CheckGameOver();
    }
Exemple #6
0
    override public void Excute(PlayerRoot pr = null)
    {
        #region マウス操作
        if (Input.GetMouseButtonDown(0))
        {
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit = new RaycastHit();
            if (Physics.Raycast(ray, out hit, Mathf.Infinity, d_layerMask))
            {
                switch (hit.collider.gameObject.layer)
                {
                case 8:     //Player
                    if (hit.collider.gameObject.GetComponent <JobBase>().controller == ReadyMode.Instance)
                    {
                        if (!isBtnShow)
                        {       //ボタンはまだ生成していない
                            pr.p_jb = hit.collider.gameObject.GetComponent <JobBase>();
                            if (pr.p_jb.CanTakeAction())
                            {
                                pr.p_jb.ShowSkillBtn();
                                isBtnShow = true;
                            }
                        }
                        // すでに生成したら
                        else
                        {
                            pr.p_jb.HideSkillBtn();
                            pr.p_jb = hit.collider.gameObject.GetComponent <JobBase>();
                            pr.p_jb.ShowSkillBtn();
                        }
                    }
                    break;

                case 10:     //Command
                    if (isBtnShow)
                    {        // ボタンを選択したら
                        // 選択したボタンを保管
                        pr.btn      = hit.collider.gameObject;
                        pr.s_script = pr.btn.GetComponent <SkillScript>();
                        pr.ChangeMode(_targetMode.Instance);
                    }
                    break;

                case 14:     //Yousei
                    // 選択したボタンを保管
                    pr.p_jb.HideSkillBtn();
                    pr.p_jb     = hit.collider.gameObject.GetComponentInParent <JobBase>();
                    pr.btn      = hit.collider.gameObject;
                    pr.s_script = pr.btn.GetComponent <SkillScript>();
                    pr.ChangeMode(_targetMode.Instance);
                    break;
                }
            }
        }
        if (Input.GetMouseButtonDown(1))
        {
            pr.p_jb.HideSkillBtn();
        }
        #endregion
        pr.CheckEndBattel();
        pr.CheckGameOver();
    }
Exemple #7
0
 override public void Enter(PlayerRoot pr = null)
 {
     // 初期化する
     pr.endBattel = false;
     pr.ChangeMode(BattelMode.Instance);
 }
Exemple #8
0
 override public void Excute(PlayerRoot pr = null)
 {
     // ボタンがなければ
     if (pr.btn == null)
     {
         pr.ChangeMode(BattelMode.Instance);
     }
     #region マウス操作
     if (Input.GetMouseButton(0))
     {
         Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
         RaycastHit hit = new RaycastHit();
         if (Physics.Raycast(ray, out hit, Mathf.Infinity, layerMask))
         {
             if (pr.btn != null)
             {
                 // ボタンを動かす
                 Vector3 pos = hit.point;
                 if (hit.collider.gameObject.layer == LayerMask.NameToLayer("Ground"))
                 {
                     pos.y += 0.2f;
                 }
                 pr.btn.transform.position = pos;
             }
         }
     }
     if (Input.GetMouseButtonUp(0))
     {
         Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
         RaycastHit hit = new RaycastHit();
         if (Physics.Raycast(ray, out hit, Mathf.Infinity, u_layerMask))
         {
             if (pr.btn != null)
             {
                 if (pr.s_script.s_targetNum != TargetNum.SELF)
                 {
                     //レイヤーが同じなら
                     if (hit.collider.gameObject.layer != LayerMask.NameToLayer("Ground"))
                     {
                         if (pr.previous_controller == KiraControl.Instance && hit.collider.gameObject.GetComponent <JobBase>()._type == JobType.Attacker)
                         {
                             SkillUse(pr, hit.collider.gameObject, pr.btn, pr.s_script.s_effectTime);
                         }
                         if (pr.previous_controller == KirenControl.Instance && hit.collider.gameObject.GetComponent <JobBase>()._type == JobType.Magician)
                         {
                             SkillUse(pr, hit.collider.gameObject, pr.btn, pr.s_script.s_effectTime);
                         }
                         if (pr.previous_controller == YumaControl.Instance)
                         {
                             SkillUse(pr, hit.collider.gameObject, pr.btn, pr.s_script.s_effectTime);
                         }
                         if (pr.previous_controller == Kiren2Control.Instance && hit.collider.gameObject.GetComponent <StatusControl>()._type == JobType.Magician)
                         {
                             SkillUse(pr, hit.collider.gameObject, pr.btn, pr.s_script.s_effectTime);
                         }
                     }
                     else
                     {
                         //ボタンを初期位置に戻す
                         pr.StartCoroutine(pr.LerpMove(pr.btn,
                                                       pr.btn.transform.localPosition, btnTempPos, 1));
                     }
                 }
                 // SELFなら、即発動
                 else
                 {
                     SkillUse(pr, pr.p_jb.gameObject, pr.btn, pr.s_script.s_effectTime);
                 }
             }
         }
         else//ボタンを初期位置に戻す
         {
             pr.StartCoroutine(pr.LerpMove(pr.btn,
                                           pr.btn.transform.localPosition, btnTempPos, 1));
         }
     }
     #endregion
     pr.CheckEndBattel();
     pr.CheckGameOver();
 }