Example #1
0
 //Ha tartalékoltuk a képességet, akkor az új ciklusban megint lehet dönteni a sorsáról
 public void NewSkillCycle()
 {
     if (skill == SkillState.Store)
     {
         this.skill = SkillState.NotDecided;
     }
 }
Example #2
0
    public void StartSkill()
    {
        if (endTarget == null)
        {
            return;
        }

        curState = SkillState.directionTarget;
        transform.LookAt(endTarget);
        isCollision   = false;
        startTimer    = Time.time;
        virtualTarget = startTarget.position;
        journeyLength = Vector3.Distance(startTarget.position, endTarget.position);
        isPlay        = true;
        StartCoroutine(UpdateSkill(0.016f));

        ShakeCamera shakeCamera = Camera.main.GetComponent <ShakeCamera>();

        if (shakeCamera != null)
        {
            if (ShakeCameraTime_Start > 0)
            {
                shakeCamera.Play(ShakeCameraTime_Start, ShakeCameraAmount_Start);
            }
        }
    }
 public static DrawState GetDrawState(Skill fsm, SkillState state, SkillStateAction action)
 {
     if (fsm == null)
     {
         return(DrawState.Normal);
     }
     if (!Application.get_isPlaying())
     {
         return(DrawState.Normal);
     }
     if (!state.get_Active() || !action.get_Active())
     {
         return(DrawState.Normal);
     }
     if (GameStateTracker.CurrentState == GameState.Break)
     {
         return(DrawState.Normal);
     }
     if (GameStateTracker.CurrentState == GameState.Paused)
     {
         return(DrawState.Paused);
     }
     if (GameStateTracker.CurrentState == GameState.Running)
     {
         return(DrawState.Active);
     }
     if (GameStateTracker.CurrentState == GameState.Error)
     {
         return(DrawState.Error);
     }
     return(DrawState.Normal);
 }
Example #4
0
 private void Awake()
 {
     mainCanvas        = GameObject.Find("Base_Canvas");
     playerField       = gameObject.transform.parent.parent.gameObject;
     this.siblingIndex = gameObject.transform.GetSiblingIndex();
     skill             = SkillState.NotDecided;
 }
Example #5
0
    /// <summary>
    /// 响应服务器消息释放技能
    /// 如果目前存在指定ID的技能实例, 则停止原来的技能, 释放新的技能.  (完全相信服务器)
    /// </summary>
    /// <param name="skillID"></param>
    private void ReleaseSkillByServerMessage(int skillID, uint targetID, Vector3 offset, int launcherIndex, bool ignorePrediction = false)
    {
        if (IsReleasingSkill(skillID))
        {
            StopSkill(skillID, false);
        }

        if (IsPredict(skillID))
        {
            return;
        }

        SkillBase newSkill = CreateSkill(skillID);

        if (newSkill != null)
        {
            if (m_RemoveSkillList.Contains(skillID))
            {
                m_RemoveSkillList.Remove(skillID);
            }

            m_IDToSkill[skillID] = newSkill;
            m_Property.SetCurrentSkillID(skillID);
        }

        SpacecraftEntity target = m_GameplayProxy.GetEntityById <SpacecraftEntity>(targetID) as SpacecraftEntity;

        m_State = newSkill.ReleaseSkillByServerMessage(targetID, offset, launcherIndex, ignorePrediction);
        m_Property.SetCurrentSkillState(m_State);
    }
Example #6
0
    // TODO. 这是一个临时接口
    // 因为本来是打算把CastSkill消息里的targetPosition也放入TargetList的, 但是服务器改动实在太大, 当前时间比较紧迫, 没有那么多时间去测试了
    // 暂时这里写代码区分单目标和多目标技能
    private void ReleaseSkillByServerMessage_MultiTarget(int skillID, List <S2C_TargetInfo> targetInfoList, Vector3 offset, int launcherIndex)
    {
        if (IsReleasingSkill(skillID))
        {
            StopSkill(skillID, false);
        }

        if (IsPredict(skillID))
        {
            return;
        }

        SkillBase newSkill = CreateSkill(skillID);

        if (newSkill != null)
        {
            if (m_RemoveSkillList.Contains(skillID))
            {
                m_RemoveSkillList.Remove(skillID);
            }

            m_IDToSkill[skillID] = newSkill;
            m_Property.SetCurrentSkillID(skillID);
        }

        m_State = newSkill.ReleaseSkillByServerMessage_MultiTarget(targetInfoList, offset, launcherIndex);
        m_Property.SetCurrentSkillState(m_State);
    }
Example #7
0
    public override void OnInitialize(ISkillRefactorProperty property)
    {
        m_Property = property;

        m_State = SkillState.Idle;
        m_Property.SetCurrentSkillState(m_State);

        m_IDToSkill                = new Dictionary <int, SkillBase>();
        m_RemoveSkillList          = new List <int>();
        m_ReleasedSkillDuringPress = new Dictionary <int, bool>();

        m_CfgSkillProxy    = GameFacade.Instance.RetrieveProxy(ProxyName.CfgSkillSystemProxy) as CfgSkillSystemProxy;
        m_SkillProxy       = GameFacade.Instance.RetrieveProxy(ProxyName.PlayerSkillProxy) as PlayerSkillProxy;
        m_CfgLanguageProxy = GameFacade.Instance.RetrieveProxy(ProxyName.CfgLanguageProxy) as CfgLanguageProxy;
        m_GameplayProxy    = GameFacade.Instance.RetrieveProxy(ProxyName.GameplayProxy) as GameplayProxy;

        m_CfgEternityProxy     = GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy;
        m_WeakSoundCD          = m_CfgEternityProxy.GetGamingConfig(1).Value.Mine.Value.Sound.Value.WeaknessSoundCd;
        m_WeakSoundTmpCD       = m_WeakSoundCD;
        m_WeakSoundProbability = m_CfgEternityProxy.GetGamingConfig(1).Value.Mine.Value.Sound.Value.WeaknessSoundRate;

        SkillBase.s_CfgSkillProxy    = m_CfgSkillProxy;
        SkillBase.s_SkillProxy       = m_SkillProxy;
        SkillBase.s_CfgLanguageProxy = m_CfgLanguageProxy;
        SkillBase.s_GameplayProxy    = m_GameplayProxy;
        SkillBase.s_CfgEternityProxy = m_CfgEternityProxy;
        SetPreditionForAllSkillType();

        // UNDONE, 声音

        PreloadSkill();
    }
Example #8
0
    /// <summary>
    /// 响应客户端的输入释放技能
    /// 会检查是否已经存在指定ID的技能实例, 如果目前没有对应的技能实例则创建并释放
    /// </summary>
    /// <param name="skillID"></param>
    private void ReleaseSkillByClientInput(int skillID)
    {
        if (!CanCreateSkill(skillID) || IsReleasingSkill(skillID) || m_SkillProxy.IsMainPlayerUsingWeaponSkill())
        {
            // UNDONE, 此处应有报错
            NotifyUnsuccessfulSkillRelease(skillID);
            return;
        }

        SkillBase newSkill = CreateSkill(skillID);

        if (!newSkill.CanReleaseSkill())
        {
            NotifyUnsuccessfulSkillRelease(skillID);
            return;
        }

        if (newSkill != null)
        {
            if (m_RemoveSkillList.Contains(skillID))
            {
                m_RemoveSkillList.Remove(skillID);
            }

            m_IDToSkill[skillID] = newSkill;
            m_Property.SetCurrentSkillID(skillID);

            m_State = newSkill.ReleaseSkillByClientInput();
            m_Property.SetCurrentSkillState(m_State);
        }
        else
        {
            Debug.LogErrorFormat("技能释放失败. ID: {0}", skillID);
        }
    }
Example #9
0
        private void LateUpdate()
        {
            skillicon.fillAmount    = 1 - skillTimer.GetRatioComplete();
            area.transform.position = Input.mousePosition;
            switch (_skillState)
            {
            case SkillState.Selected:
                if (Input.GetMouseButtonDown(0))
                {
                    ReleaseSkill();
                    skillTimer = Timer.Register(cd, null);
                    area.gameObject.SetActive(false);
                    Cursor.visible = true;
                    _skillState    = SkillState.UnSelected;
                }

                if (Input.GetMouseButtonDown(1))
                {
                    area.gameObject.SetActive(false);
                    Cursor.visible = true;
                    _skillState    = SkillState.UnSelected;
                }
                break;

            case SkillState.UnSelected:
                break;
            }
        }
Example #10
0
 public override void DoGUI()
 {
     if (Event.get_current().get_type() == null && Event.get_current().get_button() == 0 && GUIUtility.get_hotControl() == 0)
     {
         GUIUtility.set_keyboardControl(0);
     }
     StateSelector.HandleKeyboardInput();
     StateSelector.DoToolbar();
     if (FsmEditorSettings.ShowHints)
     {
         GUILayout.Box(Strings.get_Hint_State_Selector(), SkillEditorStyles.HintBox, new GUILayoutOption[0]);
     }
     StateSelector.scrollPosition = GUILayout.BeginScrollView(StateSelector.scrollPosition, new GUILayoutOption[0]);
     if (SkillEditor.SelectedFsm != null)
     {
         SkillState[] states = SkillEditor.SelectedFsm.get_States();
         for (int i = 0; i < states.Length; i++)
         {
             SkillState state = states[i];
             StateSelector.DoStateRow(state);
         }
     }
     GUILayout.EndScrollView();
     this.DoAutoScroll();
     SkillEditorGUILayout.Divider(new GUILayoutOption[0]);
     GUILayout.BeginHorizontal(new GUILayoutOption[0]);
     GUILayout.FlexibleSpace();
     GUILayout.EndHorizontal();
     EditorGUILayout.Space();
 }
Example #11
0
 // Initialize needed non-public variable after object is constructed (!Call this method after JsonUtility!)
 public void initialize()
 {
     state            = SkillState.onCD;
     curSkillCD       = skillCD;
     curSkillDuration = 0f;
     curCharge        = 0;
 }
Example #12
0
 // Method for trun skill state to CD (usually called in the skill gameObject)
 public void deactivateSkill()
 {
     if (state == SkillState.onActive)
     {
         state = SkillState.onCD;
     }
 }
Example #13
0
    public void ActiveSkill(SkillState ss)
    {
        if (IsSkillDelay(ss) == false)
        {
            return;
        }

        Base_Skill bs;

        switch (ss)
        {
        case SkillState.Red:
            bs    = skill.GetComponent <Skill_Red>();
            d_red = bs.m_delay;
            break;

        case SkillState.Green:
            bs      = skill.GetComponent <Skill_Green>();
            d_green = bs.m_delay;
            break;

        case SkillState.Blue:
            bs     = skill.GetComponent <Skill_Blue>();
            d_blue = bs.m_delay;
            break;

        default: return;
        }
        bs.ExecuteSkill(gameObject);
    }
Example #14
0
    /// <summary>
    /// 把外部控制消息转发给技能实例
    /// 包括 硬件输入消息, 网络消息
    /// </summary>
    /// <param name="skillID"></param>
    /// <param name="controlEvent"></param>
    private void SendEventToSkill(int skillID, SkillControlEvent controlEvent, SkillEventParam param)
    {
        // 当技能释放失败时, 报错. 这种时候也不检查客户端是否有对应技能, 不过按理说请求都发给服务器了, 报错, 应该客户端还在释放这个技能.
        if (controlEvent == SkillControlEvent.ServerMsg_OnFail)
        {
            // UNDONE 打印报错提示

            if (!IsReleasingSkill(skillID))
            {
                // 可能有我没考虑到的逻辑
                Assert.IsTrue(false, skillID.ToString());
            }
            else
            {
                StopSkill(skillID, false);
            }
        }

        // 如果找不到服务器要求释放的技能, 表明这个技能已经结束了或者从来没有创建过
        // 已知在如下情况下会出现这种情况
        // 1. 开启了客户端预言. 等释放技能的消息回来, 技能已经结束了
        // 2. 客户端和服务器某种状态或者数据不一致. 客户端没有成功创建技能
        if (!IsReleasingSkill(skillID))
        {
            //Assert.IsTrue(false, skillID.ToString()); // 处理非预言情况
            return;
        }

        m_State = m_IDToSkill[skillID].HandleEvent(controlEvent, param);
        m_Property.SetCurrentSkillState(m_State);
    }
        public static DrawState GetFsmStateDrawState(Skill fsm, SkillState state, bool selected)
        {
            bool active       = fsm.get_ActiveState() == state && fsm.get_Active();
            bool isBreakpoint = Skill.get_BreakAtState() == state;

            return(FsmDrawState.GetDrawState(fsm, selected, active, isBreakpoint, false));
        }
        //Játékos kártyájának skill helyzetében történt válotoztatás kezelése
        public IEnumerator HandleSkillStatusChange(SkillState state, int cardPosition, bool needToWait)
        {
            int key = modules.GetGameModule().GetCurrentKey();

            switch (state)
            {
            case SkillState.Pass:
                modules.GetDataModule().GetCardFromPlayer(key, cardPosition, CardListTarget.Field).SetSkillState(state);
                modules.GetGameModule().Pass();
                break;

            case SkillState.Use:
                modules.GetGameModule().SetActiveCardID(cardPosition);
                modules.GetDataModule().GetCardFromPlayer(key, cardPosition, CardListTarget.Field).SetSkillState(state);
                modules.GetClientModule().SetSkillState(key, cardPosition, state);
                modules.GetGameModule().Use(cardPosition);
                if (needToWait)
                {
                    yield return(modules.GetGameModule().WaitForEndOfSkill());
                }
                break;

            case SkillState.Store:
                modules.GetDataModule().GetCardFromPlayer(key, cardPosition, CardListTarget.Field).SetSkillState(state);
                modules.GetGameModule().StartCoroutine(modules.GetGameModule().Store(cardPosition));
                break;

            default:
                modules.GetDataModule().GetCardFromPlayer(key, cardPosition, CardListTarget.Field).SetSkillState(SkillState.Pass);
                modules.GetGameModule().Pass();
                break;
            }

            CheckIfFinished();
        }
Example #17
0
 public List <SkillState> SelectStates(List <SkillState> stateSelection, bool add = false, bool subtract = false)
 {
     if (this.ActiveFsm == null)
     {
         return(null);
     }
     if (!add && !subtract)
     {
         this.DeselectStates();
     }
     using (List <SkillState> .Enumerator enumerator = stateSelection.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             SkillState current = enumerator.get_Current();
             if (!subtract)
             {
                 this.AddState(current);
             }
             else
             {
                 this.RemoveState(current);
             }
         }
     }
     this.ActiveTransition = null;
     return(this.States);
 }
Example #18
0
        //Kártya húzás: Modellből adatok lekérése és továbbítása a megfelelő játékos oldalnak.
        private void DrawTheCard(int key, DrawTarget target, DrawType drawType, SkillState newState)
        {
            Card cardData = null;

            if (target == DrawTarget.Hand && !controller.GetBlindMatchState())
            {
                cardData = modules.GetDataModule().GetPlayerWithKey(key).DrawCardFromDeck();
            }

            else if (controller.GetBlindMatchState() || target == DrawTarget.Field)
            {
                cardData = modules.GetDataModule().GetPlayerWithKey(key).BlindDraw();
            }

            //Ha a felhúzás sikeres
            if (cardData != null)
            {
                modules.GetClientModule().DrawNewCard(cardData, key, modules.GetDataModule().GetPlayerWithKey(key).GetPlayerStatus(), drawType, target, newState);

                //Ha a játékosról van szó továbbítjuk megjelenítésre a deck új méretét
                if (modules.GetDataModule().GetPlayerWithKey(key).GetPlayerStatus())
                {
                    int remainingDeckSize = modules.GetDataModule().GetPlayerWithKey(key).GetDeckSize();
                    modules.GetClientModule().RefreshDeckSize(key, remainingDeckSize);
                }
            }
        }
Example #19
0
 private void DoSearch()
 {
     this.UpdateVariableList();
     this.FindEventsInGlobalTransitions();
     SkillState[] states = this.fsm.get_States();
     for (int i = 0; i < states.Length; i++)
     {
         SkillState fsmState = states[i];
         fsmState.set_Fsm(this.fsm);
         this.FindEventUsage(fsmState);
         SkillStateAction[] actions = fsmState.get_Actions();
         for (int j = 0; j < actions.Length; j++)
         {
             SkillStateAction fsmStateAction = actions[j];
             SkillSearch.currentInfo = new SkillInfo
             {
                 fsm    = this.fsm,
                 state  = fsmState,
                 action = fsmStateAction
             };
             this.FindEventsSentBy(fsmStateAction);
             this.FindVariableUsage(fsmStateAction, 0);
         }
     }
     this.UpdateUnusedEvents();
     this.UpdateUnusedVariables();
 }
Example #20
0
 private void StateAction(SkillState s, bool add)
 {
     if (s.act > 0)
     {
         if (add)
         {
             SetAction(s.act);
             AddCallbackInFrames(() => { SetAction(-2); });
         }
         else
         {
             SetAction(0);
         }
     }
     if (s.sfx > 0)
     {
         if (add)
         {
             PlayFx(s.sfx);
         }
         else
         {
             RemoveFx(s.sfx);
         }
     }
 }
		private SkillmasterDialog(PacketAPI api)
			: base(api)
		{
			Buttons = ScrollingListDialogButtons.Cancel;
			ListItemType = ListDialogItem.ListItemStyle.Large;
			DialogClosing += (o, e) =>
			{
				if (e.Result == XNADialogResult.Cancel)
				{
					Instance = null;
				}
				else if (e.Result == XNADialogResult.Back)
				{
					e.CancelClose = true;
					if (m_state == SkillState.Learn && m_showingRequirements)
					{
						m_state = SkillState.Initial; //force it to re-generate the list items
						_setState(SkillState.Learn);
						m_showingRequirements = false;
					}
					else
						_setState(SkillState.Initial);
				}
			};
			m_state = SkillState.None;

			if (LearnIcon == null || ForgetIcon == null)
			{
				//getDlgIcon
				LearnIcon = _getDlgIcon(ListIcon.Learn);
				ForgetIcon = _getDlgIcon(ListIcon.Forget);
			}
		}
Example #22
0
    public override void Enter(SkillController obj)
    {
        base.Enter(obj);

        if (obj.Type == ESkillType.TARGET)
        {
            if (enemy != null)
            {
                if ((ESkillOffense)obj.Ability == ESkillOffense.SINGLE)
                {
                    obj.transform.position = enemy.transform.position;

                    SkillState skill = obj.getCurrentState();
                    if (skill.hasDamage || skill.effectType != EBulletEffect.NONE)
                    {
                        if (obj.skillAnimation.GetComponent <SkillDamage>() == null)
                        {
                            SkillDamage dmg = obj.skillAnimation.gameObject.AddComponent <SkillDamage>();
                            dmg.damage(enemy);
                        }
                    }
                }
                else
                {
                    obj.transform.position = destPosition;
                }
            }
            else
            {
                obj.transform.position = destPosition;
            }
        }
    }
Example #23
0
    public override void setSkillCD(int readySkill)
    {
        SkillState s  = skills [readySkill];
        TowerSkill ts = GameStaticData.getInstance().getTowerSkillInfo(s.skillId);

        skillCoolDown[readySkill] = ts.cooldown[s.skillLevel - 1];
    }
Example #24
0
        public override void AbortCast()
        {
            if (IsActive())
            {
                OnFinish();
            }

            //if (IsBeingCasted())
            {
                DeleteCastingEffect();

                if (state == SkillState.SKILL_CONFIRMING)
                {
                    GetPlayerData().ActiveConfirmationSkill = null;
                    CancelConfirmation();
                    state = SkillState.SKILL_IDLE;
                    return;
                }

                if (Task != null)
                {
                    Owner.StopTask(Task);
                }

                End();
            }
        }
Example #25
0
        private IEnumerator DecideSkill()
        {
            //Várunk, hogy a főszál beérjen a lockhoz
            while (controller.GetTurnWaitStatus())
            {
                yield return(null);
            }

            GetCurrentContext();
            Debug.Log($"Card count: {cardCount}\nCurrent key: {controller.GetCurrentKey()}");
            for (var id = 0; id < cardCount; id++)
            {
                if (Module_Controller.instance.GetClientModule().AskCardSkillStatus(playerKey, id) == SkillState.NotDecided)
                {
                    //GetSkillChoiceFromAIBrain
                    SkillState choice = Bot_Behaviour.ChooseSkill(id, cardsInHand, cardsOnField, opponentCards, winAmount);
                    Module_Controller.instance.GetInputModule().ReportSkillStatusChange(SkillState.Use, id, false);

                    controller.StartCoroutine(HandleSkills());

                    //Skill lock
                    yield return(controller.WaitForEndOfSkill());
                }
            }

            //Gondolkodási idő
            yield return(new WaitForSeconds(0.05f));

            //Az AI végzett a körével a döntések után
            Module_Controller.instance.GetDataModule().GetPlayerWithKey(playerKey).SetStatus(PlayerTurnStatus.Finished);

            controller.TurnFinished();
        }
Example #26
0
        public ActiveSkill()
        {
            active                      = false;
            state                       = 0;
            castTime                    = 5;
            coolDown                    = 5;
            reuse                       = 5;
            updateFrequency             = 0.1f;
            rangeCheckFrequency         = 0.1f;
            canBeCastSimultaneously     = false;
            requireConfirm              = false;
            MovementBreaksConfirmation  = true;
            breaksMouseMovement         = true;
            resetMoveTarget             = true;
            triggersOwnerCollision      = false;
            maxConsecutiveCharges       = 1;
            consecutiveTimelimit        = 3f;
            skillToBeRechargedOnThisUse = 0;
            LastUsed                    = -1000f;
            tempDamageBoost             = -1;
            tempRangeBoost              = -1;

            image = null;

            RangeChecks = new Dictionary <GameObject, Vector3>();
        }
Example #27
0
        public override void End()
        {
            active = false;

            initTarget = null;

            Owner.Status.ActiveSkills.Remove(this);

            Owner.NotifyCastingModeChange();

            UpdateTask = null;
            Task       = null;

            state = SkillState.SKILL_IDLE;

            int count = Owner.Skills.Skills.Count;

            for (int i = 0; i < count; i++)
            {
                Skill sk = Owner.Skills.Skills[i];
                sk.NotifyAnotherSkillCastEnd(this);
            }

            OnAfterEnd();

            if (GetReuse(false) > 0)
            {
                Owner.StartTask(NotifyReuseEnd());
            }
        }
Example #28
0
        /// <summary>
        /// Start applying skill's effects to the target or targets.
        /// </summary>
        /// <returns></returns>
        private IEnumerator INTERNAL_InvokeEnum()
        {
            _agent.GetAudioSource().PlayRandomClip(_executingSkillSounds);

            _state = SkillState.Invoking;
            if (_loadingAnimation && _executingAnimation && !_loadingAnimation.Equals(_executingAnimation))
            {
                AnimateInvoking();
            }
            var beginTime = Time.time;

            if (_invocationPing >= _invocationDuration)
            {
                _agent.StartCoroutine(INTERNAL_ApplyEffectEnum());
            }
            else
            {
                while (Time.time <= beginTime + _invocationDuration)
                {
                    _agent.StartCoroutine(INTERNAL_ApplyEffectEnum());
                    if (_loadingAnimation && _executingAnimation && !_loadingAnimation.Equals(_executingAnimation))
                    {
                        AnimateInvoking();
                    }
                    yield return(new WaitForSeconds(_invocationPing));
                }
            }
            _agent.StartCoroutine(INTERNAL_CoolDownEnum());
        }
        //Jelez a vezérlőnek a felhasználó döntéséről a megadott kártyát illetően, Gombok használják
        public void ReportSkillDecision(SkillState state, int key, int cardFieldPosition)
        {
            HideCardDetailsWindow();
            GetFieldFromKey(key).SwitchCardSkillStatus(state, cardFieldPosition);

            inputModule.ReportSkillStatusChange(state, cardFieldPosition);
        }
Example #30
0
        private static void SetHealth(SkillState skill)
        {
            Player player    = GetPlayer(skill);
            int    newHealth = skill.PopBack();

            player.Health = newHealth;
        }
Example #31
0
 public void ApplyStateFeedback(SkillState state)
 {
     foreach (var item in _rends)
     {
         item.material.SetColor("_SkillStateColor", moduleFeedback[state]);
     }
 }
Example #32
0
	public void BasicSetup()
	{
		for (int i = 0; i < skillDetectors.Count; i++) {
			skillDetectors[i].Initialise(this);
		}
		outgoingAllyStatusEffects.Clear();
		outgoingEnemyStatusEffects.Clear();
		for (int i = 0; i < skillStatusEffects.Count; i++) {
			if(skillStatusEffects[i].affectAlly)
				outgoingAllyStatusEffects.Add(skillStatusEffects[i]);
			else if(skillStatusEffects[i].affectEnemy)
				outgoingEnemyStatusEffects.Add(skillStatusEffects[i]);
		}
		isOwner = ownerManager.myPhotonView.isMine;
		skillState = SkillState.ready;
	}
	void Awake()
	{
		m_transform = transform;
		m_animation = GetComponent<Animation>();
		m_audio = GetComponent<AudioSource>();
		m_rigidbody = GetComponent<Rigidbody>();
		script_monEf = Monster_efs.instance;
		enemy = GameObject.FindWithTag("Respawn").GetComponent<DB_Monster>().enemy[1];

		script_sound = GameObject.FindWithTag("sound").GetComponent<SoundEf_slash>();
		script_cam = Camera.main.GetComponent<CamMove>();
		//
		gameObject.AddComponent<Skill> ();
		m_skillScript = gameObject.GetComponent<Skill> ();
		skillData = new SkillState("enemy_normal_skill");
		skillData.Init (this);
		skillList = new SkillManager ();
		m_isDead = false;
	}
Example #34
0
            return false;
        }
 
 
 
        // 获得从当前Obj到目标Obj的方向,然后求和当前Obj的朝向夹角。
        Vector2 tarPos = new Vector2(trans.position.x, trans.position.z);
        Vector2 myPos = new Vector2(owner.transform.position.x, owner.transform.position.z);
        Vector2 mydir = new Vector2(owner.transform.forward.x, owner.transform.forward.z);
        Vector2 dir = tarPos - myPos;
        float angle = Vector2.Angle(mydir.normalized, dir.normalized);
 
        if (angle < _angle / 2f)
        {
 
            float toPosDis = Vector2.Distance(tarPos, myPos);
            if (toPosDis <= _dis)
            {
                return true;
            }
            else
Example #35
0
	bool HasEnoughGold(SkillState ef, SkillState ma, SkillState pa)
	{
		int effectPrice=0;
		int mathPrice=0;
		int passivePrice=0;

		if (SkillState.None != ef) {
			effectPrice = DataManager.Instance.AllSkillData [(int)ef].Price;
		}
		if (SkillState.None != ma) {
			mathPrice = DataManager.Instance.AllSkillData [(int)ma].Price;
		}
		if (SkillState.None != pa) {
			passivePrice = DataManager.Instance.AllSkillData [(int)pa].Price;	
		}
		int totalValue = m_nTempPrice - (effectPrice + mathPrice + passivePrice); 			
		if (0 > totalValue) {
			//사려는 금액보다 가지고 있는 돈의 액수가 적을경우 
			Debug.Log("Not Enough Momey");
			SetPopup ();
			return false;
		}
		return true;
	}
Example #36
0
	public virtual void ExitState(SkillState state)
	{
	}
Example #37
0
     return false;
 }
Example #38
0
	public virtual void EnterState(SkillState state)
	{
		switch(state)
		{
		case SkillState.ready:
			TriggerSkillEvents(SkillEventTrigger.onReady);
			break;
		case SkillState.precast:
			TriggerSkillEvents(SkillEventTrigger.onPreCast);
			break;
		case SkillState.onUse:
			TriggerSkillEvents(SkillEventTrigger.onUse);
			break;
		case SkillState.followThrough:
			TriggerSkillEvents(SkillEventTrigger.onFollowThrough);
			break;
		}
	}
Example #39
0
	public override void OnPress (GameObject oBtn)
	{
		if (oBtn.name == "BtnEasy") {
			m_eStageLevel = StageLevel.Easy;
		} else if (oBtn.name == "BtnNormal") {
			m_eStageLevel = StageLevel.Normal;
		} else if (oBtn.name == "BtnHard") {
			m_eStageLevel = StageLevel.Hard;
		} else if (oBtn.name == "BtnGameStart") {
			InGameData ();
			AdsData.PlayAds ();
		} else if (oBtn.name == "BtnBack") {
			ResetGold ();
			ResetItem ();
			m_sManager.SetScene (SceneState.Main);
		} else if (oBtn.name == "ViewEffect") {
			m_eEffect = SkillState.None;
		} else if (oBtn.name == "ViewMath") {
			m_eMath = SkillState.None;
		} else if (oBtn.name == "ViewPassive") {
			m_ePassive = SkillState.None;
		} else if (oBtn.name.Contains ("Skill")) {
			int idx = int.Parse (oBtn.name.Replace ("Skill", ""));
			if (3 > idx) {
				if (HasEnoughGold((SkillState)idx, m_eMath, m_ePassive)) {
					m_eEffect = (SkillState)idx;	
				}
			} else if (5 < idx) {
				if (HasEnoughGold(m_eEffect, m_eMath, (SkillState)idx)) {
					m_ePassive = (SkillState)idx;	
				}
			} else {
				if (HasEnoughGold(m_eEffect, (SkillState)idx, m_ePassive)) {
					m_eMath = (SkillState)idx;
				}
			}
		}
		SetStageLevel ();
		SetAllSkill ();	
	}
Example #40
0
	public virtual void ResetSkill()
	{
		ownerStatus.RemoveStatusEffect(this);
		isBusy = false;
		ActivateSkill(false);
		HitTargets.Clear();
		skillState = SkillState.ready;

	}
Example #41
0
        if (State == SkillState.None)
            return true;

        if (dataVo.minInterrupt != -1 && timer <= dataVo.minInterrupt)
Example #42
0
	void ResetItem()
	{
		m_eEffect 	= SkillState.None;
		m_eMath 	= SkillState.None;
		m_ePassive 	= SkillState.None;
	}
Example #43
0
	public void UseGameSkill(SkillState eState){
		if (SkillState.RoseOfWinds == eState) {
			for (int i = 0; i < ListEnemy.Count; ++i) {
				Destroy (ListEnemy[i]);
			}
			ListEnemy.Clear ();
		} else {
			for (int i = 0; i < ListEnemy.Count; ++i) {
				EnemyData eData = ListEnemy [i].GetComponent<EnemyScript> ().GetEnemyData;
				if (SkillState.Accuracy == eState) {
					if (EnemyState.Crow == eData.eType) {
						Destroy (ListEnemy [i]);
						ListEnemy.RemoveAt (i);
						break;
					}
				} else if (SkillState.Bomb == eState) {
					if (EnemyState.Crow != eData.eType) {
						Destroy (ListEnemy [i]);
						ListEnemy.RemoveAt (i);
						break;
					}
				}
			}
		}
	}
Example #44
0
 public void backupstates()
 {
     backuptravel = _States.TravelerState;
         backupmining = _States.MiningState;
         backupdrone = _States.DroneState;
         backupfitting = _States.fittingstate;
         backuplogin = _States.LoginState;
         backupskill = _States.SkillState;
         backuptut = _States.tutstates;
 }
		private void _setState(SkillState newState)
		{
			SkillState old = m_state;

			if (old == newState) return;

			int numToLearn = m_skills.Count(_skill => !World.Instance.MainPlayer.ActiveCharacter.Spells.Exists(_spell => _spell.id == _skill.ID));
			int numToForget = World.Instance.MainPlayer.ActiveCharacter.Spells.Count;

			if (newState == SkillState.Learn && numToLearn == 0)
			{
				EOMessageBox.Show(DATCONST1.SKILL_NOTHING_MORE_TO_LEARN, XNADialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
				return;
			}

			ClearItemList();
			switch (newState)
			{
				case SkillState.Initial:
				{
					string learnNum = string.Format("{0}{1}", numToLearn, World.GetString(DATCONST2.SKILLMASTER_ITEMS_TO_LEARN));
					string forgetNum = string.Format("{0}{1}", numToForget, World.GetString(DATCONST2.SKILLMASTER_ITEMS_LEARNED));

					ListDialogItem learn = new ListDialogItem(this, ListDialogItem.ListItemStyle.Large, 0)
					{
						Text = World.GetString(DATCONST2.SKILLMASTER_WORD_LEARN),
						SubText = learnNum,
						IconGraphic = LearnIcon,
						ShowItemBackGround = false,
						OffsetY = 45
					};
					learn.OnLeftClick += (o, e) => _setState(SkillState.Learn);
					learn.OnRightClick += (o, e) => _setState(SkillState.Learn);
					AddItemToList(learn, false);

					ListDialogItem forget = new ListDialogItem(this, ListDialogItem.ListItemStyle.Large, 1)
					{
						Text = World.GetString(DATCONST2.SKILLMASTER_WORD_FORGET),
						SubText = forgetNum,
						IconGraphic = ForgetIcon,
						ShowItemBackGround = false,
						OffsetY = 45
					};
					forget.OnLeftClick += (o, e) => _setState(SkillState.Forget);
					forget.OnRightClick += (o, e) => _setState(SkillState.Forget);
					AddItemToList(forget, false);

					ListDialogItem forgetAll = new ListDialogItem(this, ListDialogItem.ListItemStyle.Large, 2)
					{
						Text = World.GetString(DATCONST2.SKILLMASTER_FORGET_ALL),
						SubText = World.GetString(DATCONST2.SKILLMASTER_RESET_YOUR_CHARACTER),
						IconGraphic = ForgetIcon,
						ShowItemBackGround = false,
						OffsetY = 45
					};
					forgetAll.OnLeftClick += (o, e) => _setState(SkillState.ForgetAll);
					forgetAll.OnRightClick += (o, e) => _setState(SkillState.ForgetAll);
					AddItemToList(forgetAll, false);

					_setButtons(ScrollingListDialogButtons.Cancel);
				}
					break;
				case SkillState.Learn:
				{
					int index = 0;
					for (int i = 0; i < m_skills.Count; ++i)
					{
						if (World.Instance.MainPlayer.ActiveCharacter.Spells.FindIndex(_sp => m_skills[i].ID == _sp.id) >= 0)
							continue;
						int localI = i;

						SpellRecord spellData = (SpellRecord) World.Instance.ESF.Data[m_skills[localI].ID];

						ListDialogItem nextListItem = new ListDialogItem(this, ListDialogItem.ListItemStyle.Large, index++)
						{
							Visible = false,
							Text = spellData.Name,
							SubText = World.GetString(DATCONST2.SKILLMASTER_WORD_REQUIREMENTS),
							IconGraphic = World.GetSpellIcon(spellData.Icon, false),
							ShowItemBackGround = false,
							OffsetY = 45,
							ID = m_skills[localI].ID
						};
						nextListItem.OnLeftClick += (o, e) => _learn(m_skills[localI]);
						nextListItem.OnRightClick += (o, e) => _learn(m_skills[localI]);
						nextListItem.OnMouseEnter += (o, e) => _showRequirementsLabel(m_skills[localI]);
						nextListItem.SetSubtextLink(() => _showRequirements(m_skills[localI]));
						AddItemToList(nextListItem, false);
					}

					_setButtons(ScrollingListDialogButtons.BackCancel);
				}
					break;
				case SkillState.Forget:
				{
					TextInputDialog input = new TextInputDialog(World.GetString(DATCONST1.SKILL_PROMPT_TO_FORGET, false), 32);
					input.SetAsKeyboardSubscriber();
					input.DialogClosing += (sender, args) =>
					{
						if (args.Result == XNADialogResult.Cancel) return;
						bool found =
							World.Instance.MainPlayer.ActiveCharacter.Spells.Any(
								_spell => ((SpellRecord) World.Instance.ESF.Data[_spell.id]).Name.ToLower() == input.ResponseText.ToLower());

						if (!found)
						{
							args.CancelClose = true;
							EOMessageBox.Show(DATCONST1.SKILL_FORGET_ERROR_NOT_LEARNED, XNADialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
							input.SetAsKeyboardSubscriber();
						}

						if (!m_api.ForgetSpell(
								World.Instance.MainPlayer.ActiveCharacter.Spells.Find(
									_spell => ((SpellRecord) World.Instance.ESF.Data[_spell.id]).Name.ToLower() == input.ResponseText.ToLower()).id))
						{
							Close();
							((EOGame)Game).DoShowLostConnectionDialogAndReturnToMainMenu();
						}
					};

					//should show initial info in the actual dialog since this uses a pop-up input box
					//	to select a skill to remove
					newState = SkillState.Initial;
					goto case SkillState.Initial;
				}
				case SkillState.ForgetAll:
				{
					_showForgetAllMessage(_forgetAllAction);
					_setButtons(ScrollingListDialogButtons.BackCancel);
				}
					break;
			}

			m_state = newState;
		}
Example #46
0
 private void StateAction(SkillState s, bool add)
 {
     if (s.act > 0)
     {
         if (add)
         {
             SetAction(s.act);
             AddCallbackInFrames(() => { SetAction(-2); });
         }
         else
         {
             SetAction(0);
         }
     }
     if (s.sfx > 0)
     {
         if (add)
         {
             PlayFx(s.sfx);
         }
         else
         {
             RemoveFx(s.sfx);
         }
     }
 }
Example #47
0
            public bool TiroPuerta = false; // Ha declarado tiro a puerta?

            #endregion Fields

            #region Constructors

            public PlayerState()
            {
                for (int i = 1; i <= SkillsCount; i++)
                    Skills[i] = new SkillState();
            }
Example #48
0
 private void StateActionPriority(SkillState oldSt, SkillState newSt)
 {
     if (oldSt == null && newSt == null)
     {
         return;
     }
     if (oldSt != null && newSt == null)
     {
         StateAction(oldSt, false);
         return;
     }
     if (oldSt == null && newSt != null)
     {
         StateAction(newSt, true);
         return;
     }
     if ((oldSt.showPriority < newSt.showPriority) || (oldSt.id < newSt.id))
     {
         StateAction(oldSt, false);
         AddCallbackInFrames<SkillState, bool>((s, b) => { StateAction(s, b); }, newSt, true, 5);
     }
 }
 void Awake()
 {
     controller = transform.parent.GetComponent<SkillController>();
     state = controller.listState[controller.StateAction];
 }