Пример #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>().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();
    }
Пример #2
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();
    }
Пример #3
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();
 }