Esempio n. 1
0
 private void SkillInput()
 {
     //스킬 버튼 누를 때
     if (_state == InputState.None)
     {
         if (Input.GetKeyDown(KeyCode.Q))
         {
             _state = InputState.SkillWait;
             _skill = _characters[_selectCharactorIdx].skill_first;
             Debug.Log("선택스킬 : " + _skill);
         }
         if (Input.GetKeyDown(KeyCode.W))
         {
             _state = InputState.SkillWait;
             _skill = _characters[_selectCharactorIdx].skill_second;
             Debug.Log("선택스킬 : " + _skill);
         }
     }
     //스킬 누르고 타겟 누를 때
     if (_state == InputState.SkillWait)
     {
         if (Input.GetMouseButtonDown(0))
         {
             _skillState = CheckSkillState(_skill);
             _characters[_selectCharactorIdx].skillStateData.skillState        = _skillState;
             _characters[_selectCharactorIdx].skillStateData.skillMakeCallback = MakeSkill;
             _state = InputState.None;
         }
         else if (Input.GetMouseButtonDown(1))
         {
             _characters[_selectCharactorIdx].skillStateData.Clear();
             _state = InputState.None;
         }
     }
 }
Esempio n. 2
0
        public static SkillInfoAttribute GetSkillInfo(this eSkill skill)
        {
            var attr = skill.GetType().GetCustomAttributes(typeof(SkillInfoAttribute), false).FirstOrDefault() as SkillInfoAttribute;

            Debug.Assert(attr != null, $"Skill {skill} does not contain SkillInfo attribute.");
            return(attr);
        }
    /// <summary>
    /// 스킬을 해금하고 획득합니다.이미 있으면 아무것도 안하지롱
    /// </summary>
    private void UnlockSkill(eSkill _skill)
    {
        switch (_skill)
        {
        case eSkill.RESTORE:
            if (unlockWind == false)     //해금하지 않은 상태라면
            {
                unlockRestore = true;
                skillRestore  = new Skill_Restore(PlayerController.Instance);

                RestoreInit();
                skillList.Add(skillRestore);
            }


            break;

        case eSkill.WINDGILDE:
            if (unlockWind == false)     //해금하지 않은 상태라면
            {
                unlockWind     = true;
                skillWindGilde = new Skill_WindGlide(PlayerController.Instance);

                WindInit();
                skillList.Add(skillWindGilde);
            }
            break;

        case eSkill.LIGHTNINGSHOCK:
            if (unlockLightning == false)     //해금하지 않은 상태라면
            {
                unlockLightning     = true;
                skillLightningShock = new Skill_LightningShock(PlayerController.Instance);
                LightningInit();
                skillList.Add(skillLightningShock);
            }
            break;

        case eSkill.WATERWAVE:
            if (unlockWater == false)     //해금하지 않은 상태라면
            {
                unlockWater    = true;
                skillWaterWave = new Skill_WaterWave(PlayerController.Instance);
                WaterInit();
                skillList.Add(skillWaterWave);
            }
            break;


        default:
            break;
        }
    }
Esempio n. 4
0
    protected override void Update()
    {
        if (ControlsManager.TapActionRequested())
        {
            Vector3  tapVector             = ControlsManager.GetTapActionPoint();
            TimeSpan timeFromLastSkillPick = DateTime.Now - m_LastPick;

            if (SelectedSkill != eSkill.ePlaceDragonlingClicked && timeFromLastSkillPick.TotalMilliseconds >= 50)
            {
                switch (SelectedSkill)
                {
                case eSkill.eAddRemoveRoomClicked:
                    if (!PlayerInRoom(tapVector))
                    {
                        m_RemoveAddRoom.CmdUseSkill(tapVector);
                    }
                    break;

                case eSkill.ePlaceTrapClicked:
                    m_PlaceTrap.CmdUseSkill(tapVector);
                    break;

                case eSkill.eEntombClicked:
                    m_Entomb.CmdUseSkill(tapVector);
                    break;

                case eSkill.eFireBreathClicked:
                    m_FireBreath.CmdUseSkill(tapVector);
                    break;

                default:
                    break;
                }
                SelectedSkill = 0;
            }
        }
        else if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Moved && (DateTime.Now - CameraControls.StartPositionTime).TotalMilliseconds <= 500.0)
        {
            Vector3 position = Input.GetTouch(0).position;
            Debug.Log("why???");
            if (SelectedSkill == eSkill.ePlaceDragonlingClicked && Vector3.Distance(position, CameraControls.StartPosition) > 5f)
            {
                m_PlaceDragonling.CmdUseSkill(Camera.main.ScreenToWorldPoint(CameraControls.StartPosition));
            }
        }
        base.Update();
    }
Esempio n. 5
0
    /// <summary>
    /// 데이터가 없으므로 스킬종류 수동으로 구별
    /// </summary>
    /// <returns></returns>
    private eSkillState CheckSkillState(eSkill skill)
    {
        eSkillState state = eSkillState.Nomal;

        switch (skill)
        {
        case eSkill.SinglePoisonSkill:
            state = eSkillState.JustMake;
            break;

        case eSkill.Sniping:
            state = eSkillState.NonTarget_Cast;
            break;

        default:
            state = eSkillState.NonTarget_Cast;    // state = eSkillState.Nomal;
            break;
        }
        return(state);
    }
Esempio n. 6
0
    /// <summary>
    /// 스킬 생성함 프리팹이름이 스킬클래스 이름이어야함
    /// </summary>
    /// <typeparam name="T">스킬 객체만 ㅇㅋ</typeparam>
    public void Create(eSkill skill, SkillData skillData)
    {
        if (skillData == null)
        {
            return;
        }
        GameObject loadPrefab = Resources.Load <GameObject>("Prefabs/Skill/" + skill.ToString());

        if (loadPrefab == null)
        {
            Debug.Log("스킬 안만들어짐");
            return;
        }
        Skill newSkill = Instantiate(loadPrefab, _skillRoot.transform).GetComponent <Skill>();

        newSkill.IDX = _skillCount;
        _skillDict.Add(_skillCount, newSkill);

        newSkill.OnSet(skillData);
        newSkill.Data.createEffectCallback.SafeInvoke();
        Debug.Log("스킬 생성 " + skill.ToString() + " 스킬번호 : " + _skillCount + "/ 플레이어 번호 :" + skillData.player_info.idx);
        _skillCount++; // TODO 키 유니크하게 관리해야함
    }
Esempio n. 7
0
 public void OnRemoveAddRoom()
 {
     m_LastPick = DateTime.Now;
     SelectedSkill = eSkill.eAddRemoveRoomClicked;
 }
Esempio n. 8
0
 public void OnPlaceTrap()
 {
     m_LastPick = DateTime.Now;
     SelectedSkill = eSkill.ePlaceTrapClicked;
 }
Esempio n. 9
0
 public void OnPlaceDragonling()
 {
     m_LastPick = DateTime.Now;
     SelectedSkill = eSkill.ePlaceDragonlingClicked;
 }
Esempio n. 10
0
 public void OnFireBreath()
 {
     m_LastPick = DateTime.Now;
     SelectedSkill = eSkill.eFireBreathClicked;
 }
Esempio n. 11
0
 public void OnEntomb()
 {
     m_LastPick = DateTime.Now;
     SelectedSkill = eSkill.eEntombClicked;
 }
Esempio n. 12
0
 private void disableAllFlags()
 {
     SelectedSkill = 0;
 }
Esempio n. 13
0
 public void OnPlaceDragonling()
 {
     m_LastPick    = DateTime.Now;
     SelectedSkill = eSkill.ePlaceDragonlingClicked;
 }
Esempio n. 14
0
 private void disableAllFlags()
 {
     SelectedSkill = 0;
 }
Esempio n. 15
0
 public void OnRemoveAddRoom()
 {
     m_LastPick    = DateTime.Now;
     SelectedSkill = eSkill.eAddRemoveRoomClicked;
 }
Esempio n. 16
0
 public DragonScript()
 {
     SelectedSkill = 0;
 }
Esempio n. 17
0
 public void OnFireBreath()
 {
     m_LastPick    = DateTime.Now;
     SelectedSkill = eSkill.eFireBreathClicked;
 }
Esempio n. 18
0
 public void OnEntomb()
 {
     m_LastPick    = DateTime.Now;
     SelectedSkill = eSkill.eEntombClicked;
 }
Esempio n. 19
0
    protected override void Update()
    {
        if (ControlsManager.TapActionRequested())
        {
            Vector3 tapVector = ControlsManager.GetTapActionPoint();
            TimeSpan timeFromLastSkillPick = DateTime.Now - m_LastPick;

            if (SelectedSkill != eSkill.ePlaceDragonlingClicked && timeFromLastSkillPick.TotalMilliseconds >= 50)
            {
                switch (SelectedSkill)
                {
                    case eSkill.eAddRemoveRoomClicked:
                        if (!PlayerInRoom(tapVector))
                        {
                            m_RemoveAddRoom.CmdUseSkill(tapVector);
                        }
                        break;
                    case eSkill.ePlaceTrapClicked:
                        m_PlaceTrap.CmdUseSkill(tapVector);
                        break;
                    case eSkill.eEntombClicked:
                        m_Entomb.CmdUseSkill(tapVector);
                        break;
                    case eSkill.eFireBreathClicked:
                        m_FireBreath.CmdUseSkill(tapVector);
                        break;
                    default:
                        break;
                }
                SelectedSkill = 0;
            }
        }
        else if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Moved && (DateTime.Now - CameraControls.StartPositionTime).TotalMilliseconds <= 500.0)
        {
            Vector3 position = Input.GetTouch(0).position;
            Debug.Log("why???");
            if (SelectedSkill == eSkill.ePlaceDragonlingClicked && Vector3.Distance(position, CameraControls.StartPosition) > 5f)
            {
                m_PlaceDragonling.CmdUseSkill(Camera.main.ScreenToWorldPoint(CameraControls.StartPosition));
            }
        }
        base.Update();
    }
Esempio n. 20
0
 public void OnPlaceTrap()
 {
     m_LastPick    = DateTime.Now;
     SelectedSkill = eSkill.ePlaceTrapClicked;
 }