コード例 #1
0
        public Vec3 SampleNavPosition(Vec3 searchPoint)
        {
            NavStatus status = this._pathManager.GetNearestPoint(searchPoint, out Vec3 resultPoint);

            if (status != NavStatus.Sucess)
            {
                LLogger.Warning(status);
            }
            return(resultPoint);
        }
コード例 #2
0
ファイル: Bio.cs プロジェクト: niuniuzhu/Lockstep
 internal bool DestroyBuffState(BSBase bs)
 {
     if (this._buffStatesToDestroy.Contains(bs))
     {
         LLogger.Warning("BuffState {0} already in destroy list", bs.id);
         return(false);
     }
     this._buffStatesToDestroy.Add(bs);
     return(true);
 }
コード例 #3
0
        public bool NavMeshRaycast(Vec3 src, Vec3 dest, out Vec3 hitPosition, out Vec3 hitNormal)
        {
            NavStatus status = this._pathManager.Raycast(src, dest, out float hitParameter, out hitNormal);

            if (status != NavStatus.Sucess)
            {
                LLogger.Warning(status);
            }
            hitPosition = src + (dest - src) * hitParameter;
            //True if the ray is terminated before reaching target position. Otherwise returns false.
            return(hitParameter < 1);
        }
コード例 #4
0
ファイル: FollowPath.cs プロジェクト: niuniuzhu/Lockstep
        public void Set(Vec3[] corners)
        {
            this.path = new Path(corners);

            if (!this.path.vaild)
            {
                LLogger.Warning("Invalid path");
                return;
            }
            this.complete = false;
            this.path.Next();
        }
コード例 #5
0
        /// <summary>
        /// 状态转换
        /// </summary>
        /// <param name="type">指定需要转换的状态</param>
        /// <param name="force">是否强制转换(即需要转换的状态是当前状态的情况下仍然转换)</param>
        /// <param name="param">参数</param>
        public bool ChangeState(FSMStateType type, bool force = false, params object[] param)
        {
            FSMState state;

            this._states.TryGetValue(type, out state);
            if (state != null)
            {
                return(this.InternalChangeState(state, force, param));
            }

            LLogger.Warning("State '{0}' not exist.", type);
            return(false);
        }
コード例 #6
0
        protected override void OnEnter(object[] param)
        {
            this._skill       = ( Skill )param[0];
            this._target      = ( Bio )param[1];
            this._targetPoint = ( Vec3 )param[2];

            this._target?.AddRef();

            this._time       = 0f;
            this._atkTime    = this._skill.atkTime / this.owner.property.attackSpeedFactor;
            this._firingTime = this._skill.firingTime / this.owner.property.attackSpeedFactor;

            this._skill.property.Equal(Attr.Cooldown, MathUtils.Max(this._atkTime, this._skill.cd));

            this.owner.UpdateVelocity(Vec3.zero);
            this.owner.brain.enable = false;
            this.owner.usingSkill   = this._skill;
            this.owner.property.Equal(Attr.InterruptTime, this.owner.battle.time + this._skill.sufTime);
            this.owner.property.Add(Attr.Mana, -this._skill.manaCost);

            if (this._skill.castType == CastType.Dash)
            {
                this.owner.property.Add(Attr.Dashing, 1);
                Vec3 point = this._target?.property.position ?? this._targetPoint;
                this.owner.steering.dash.Set(point, this._skill.dashStartSpeed, this._skill.dashSpeedCurve,
                                             this._atkTime);
                this.owner.steering.On(SteeringBehaviors.BehaviorType.Dash);
            }

            if (this._skill.firingTime > this._skill.atkTime)
            {
                LLogger.Warning("Firing time must less or equal then attack time.");
            }

            if (MathUtils.Approximately(this._firingTime, 0f))
            {
                this.OnFire();
            }

            if (MathUtils.Approximately(this._atkTime, 0f))
            {
                this.NextState();
            }
        }
コード例 #7
0
        public Vec3[] GetPathCorners(Vec3 src, Vec3 dest)
        {
            NavStatus status = this._pathManager.CalculatePath(src, dest, out Vec3[] corners);

            if (status != NavStatus.Sucess)
            {
                LLogger.Warning(status);
            }
            if (corners == null)
            {
                return(null);
            }
            int count = corners.Length;

            for (int i = 0; i < count; i++)
            {
                corners[i].y = 0f;
            }
            return(corners);
        }