Exemple #1
0
    protected override UpdateRetCode onUpdate(uint elapsed)
    {
        if (!getState(StateAwake))
        {
            ErrorHandler.Parse(ErrorCode.ConfigError, "skillbuff isn't awake");
            return(UpdateRetCode.Aborted);
        }

        if (mTaskManager != null)
        {
            mTaskManager.Update(elapsed);
        }

        // buff本身所带的效果可能终止自身.
        if (!getState(StateAwake))
        {
            return(UpdateRetCode.Aborted);
        }

        if (mBuffRes.lifeMilliseconds == uint.MaxValue)
        {
            return(UpdateRetCode.Continue);
        }

        if (mLifeTime < elapsed || (mLifeTime -= elapsed) == 0)
        {
            return(UpdateRetCode.Finished);
        }

        return(UpdateRetCode.Continue);
    }
Exemple #2
0
    public override bool Update(uint elapsed)
    {
        if (IsDead())
        {
            return(false);
        }

        mTaskManager.Update(elapsed);

        BaseScene scn = SceneManager.Instance.GetCurScene();

        if (scn == null)
        {
            return(false);
        }

        // 接触时爆炸.
        if (mAwake && mTrapResource.collideRadius > 0)
        {
            Vector3   myPosition = GetPosition();
            ArrayList container  = Scene.SearchBattleUnit(new Vector2f(myPosition.x, myPosition.z), mTrapResource.collideRadius);

            if (container != null && containsEnemy(container))
            {
                explodeCountBackwards(null);
                mTaskManager.Stop();
                mTaskManager.AddTask(new SkillUtilities.Task(mTrapResource.explodeDelay, explode, null));
                mTaskManager.Start();
            }
        }

        return(base.Update(elapsed));
    }
Exemple #3
0
    override protected UpdateRetCode onUpdate(uint elapsed)
    {
        if (mState == ActionSkillState.Invalid)
        {
            return(UpdateRetCode.Aborted);
        }

        uint skillResID = dbgSkillResId;

        mTaskManager.Update(elapsed);

        // 技能效果可能把技能自身中断.
        if (mState == ActionSkillState.Invalid)
        {
            GameDebug.Log("skill " + skillResID + " interrupted by itself");
            return(UpdateRetCode.Aborted);
        }

        UpdateRetCode retCode = UpdateRetCode.Continue;

        mStateTimer += elapsed;

        switch (mState)
        {
        case ActionSkillState.Charging:
            // 如果过了准备时间, 那么进入使用状态.
            if (mStateTimer > mSkillUsing.skillRes.chargeTime)
            {
                ErrorCode ec = EnterUseState(SkillTargetPosition);
                if (ec != ErrorCode.Succeeded)
                {
                    retCode = UpdateRetCode.Aborted;
                }
            }
            break;

        case ActionSkillState.Using:
            if (mSkillUseStateLoopLeft == 0)
            {
                retCode = UpdateRetCode.Finished;
            }
            break;
        }

        return(retCode);
    }