Ejemplo n.º 1
0
    public void ComboAttack(Orient dir)
    {
        double nowAtTime = TimerSvc.Ins.GetNowTime();

        if (CurState == EnityState.Attack)
        {
            if (nowAtTime - lastAtTime < Constants.ComboInterval && lastAtTime != 0)
            {
                if (comboSkill[comboIndex] != comboSkill[comboSkill.Length - 1])
                {
                    Debug.Log("==========combo");
                    comboIndex += 1;
                    comboQue.Enqueue(comboSkill[comboIndex]);
                    lastAtTime = nowAtTime;
                }
                else
                {
                    lastAtTime = 0;
                    comboIndex = 0;
                }
            }
        }
        else if (CurState == EnityState.Idle)
        {
            lastAtTime = nowAtTime;
            comboIndex = 0;
            stateMgr.ChangeState(this, EnityState.Attack, comboSkill[comboIndex], dir);
        }
    }
Ejemplo n.º 2
0
    public void OnInit(StateMgr _mgr, GameObject rootSprite)
    {
        this.mgr = _mgr;
        this.uiRoot = rootSprite;

        GameObject o = uiRoot.transform.Find("Window/Button - Exit").gameObject;
        UIEventListener.Get(o).onClick = (ooo) =>
        {
            Debug.Log("onclick.");
            mgr.ChangeState("state1");
        };
    }
Ejemplo n.º 3
0
    public void OnInit(StateMgr _mgr, GameObject rootSprite)
    {
        this.mgr    = _mgr;
        this.uiRoot = rootSprite;

        GameObject o = uiRoot.transform.Find("Window/Button - Exit").gameObject;

        UIEventListener.Get(o).onClick = (ooo) =>
        {
            Debug.Log("onclick.");
            mgr.ChangeState("state1");
        };
    }
Ejemplo n.º 4
0
    public bool ChangeState(PlayerState state, bool isCns = false)
    {
        if (m_StateMgr == null)
        {
            return(false);
        }
        var display = this.PlyDisplay;

        if (display == null)
        {
            return(false);
        }
        if (display.PlyType == InputPlayerType.none)
        {
            return(false);
        }
        if (!isCns)
        {
            if (m_CurrentCnsDef == null && m_StateMgr.CurrStateKey == state && m_HasFirstChangedStated)
            {
                return(false);
            }
        }
        CNSStateDef selDef = null;

        if (!m_HasFirstChangedStated)
        {
            m_HasFirstChangedStated = true;
        }
        if (!isCns)
        {
            if (!display.HasBeginActionSrpiteData(state, true))
            {
                return(false);
            }
        }
        else
        {
            var player = display.GPlayer;
            if (player == null)
            {
                return(false);
            }
            var cnsCfg = player.CnsCfg;
            if (cnsCfg == null)
            {
                if (player.LuaCfg != null)
                {
                    cnsCfg = player.LuaCfg.CnsCfg;
                }
            }
            if (cnsCfg == null || !cnsCfg.HasStateDef)
            {
                return(false);
            }
            var def = cnsCfg.GetStateDef((int)state);
            if (def == null)
            {
                return(false);
            }
            if (!display.HasBeginActionSrpiteData((PlayerState)def.Anim))
            {
                return(false);
            }
            selDef = def;
        }

        m_CurrentCnsDef = selDef;

        m_IsCnsState = isCns;
        bool ret = m_StateMgr.ChangeState(state, m_IsCnsState);

        if (ret)
        {
            m_CurrentCnsDef = selDef;
        }
        else
        {
            m_CurrentCnsDef = null;
        }
        return(ret);
    }
Ejemplo n.º 5
0
 public void Idle()
 {
     stateMgr.ChangeState(this, AniState.Idle, null);
 }