Beispiel #1
0
        public override bool TickMove(LogicMove lm, int ms)
        {
            int useDelta = this._lifeRemain < ms ? this._lifeRemain : ms;

            lm.MoveOneStep(useDelta * speed * 0.001f * this._dir);
            this._lifeRemain -= useDelta;
            return(this._lifeRemain == 0);
        }
Beispiel #2
0
    public override bool LogicTick(StateMachine machine, int ms)
    {
        if (!_isAvaliable)
        {
            return(true);
        }
        _isAvaliable = false;
        LogicMove lm = machine.HostEntity.GetComponent <LogicMove>();

        if (lm != null)
        {
            AttrComponent attr  = machine.HostEntity.GetComponent <AttrComponent>();
            SafeFloat     speed = attr.GetAttr(Attr.MoveSpeed);
            lm.MoveOneStep(speed * new SafeV3(_args.DirX, 0, _args.DirZ));
        }

        return(false);
    }
Beispiel #3
0
        public override bool TickMove(LogicMove lm, int ms)
        {
            LogicEntity targetEntity = EntityManager.Instance.GetEntity(this._targetId);

            if (targetEntity == null)
            {
                this.InvokeCallback(true);
                return(true);
            }
            LogicTransform targetTran = targetEntity.GetComponent <LogicTransform>();
            SafeV3         dir        = targetTran.position - lm.HostEntity.LogicTran.position;

            if (dir.magnitude * 1000 < speed * ms)
            {
                lm.HostEntity.LogicTran.position = targetTran.position;
                this.InvokeCallback(false);
                return(true);
            }
            dir.SetNormalize();

            lm.MoveOneStep(ms * speed * 0.001f * dir);
            return(false);
        }