Ejemplo n.º 1
0
    public void AddMove(SafeV3 dir, int lifeTime, SafeFloat speed, MoveOverCallback overCall)
    {
        MoveByDir md = new MoveByDir(dir, lifeTime, overCall, speed);

        md.Init();
        _allMoves.Add(md);
    }
Ejemplo n.º 2
0
 public LogicGameObject(GameObject target, SafeV3 initPos)
 {
     _go           = target;
     _transform    = target.transform;
     position      = initPos;
     _isLoadedByMe = false;
 }
Ejemplo n.º 3
0
    public override void LogicTick(int ms)
    {
        SafeV3 selfPos = this.HostEntity.LogicTran.position;

        foreach (var item in EntityManager.Instance.GetAllEntitys())
        {
            if (item.EntityKey != this._releaserKey)
            {
                if (SafeV3.SqrDistance(item.LogicTran.position, selfPos) < _checkSqrRange)
                {
                    EntityManager.Instance.DestroyEntity(this.HostEntity.EntityKey);
                }
            }
        }
    }
Ejemplo n.º 4
0
    public void AddJoyInput(SafeV3 joyDir)
    {
        if (CtrlEntityKey == 0)
        {
            return;
        }
        LogicEntity entity = EntityManager.Instance.GetEntity(CtrlEntityKey);

        if (entity != null)
        {
            //entity.LogicTran.eulerAngles
        }
        else
        {
            Debug.LogError("AddJoyInput() no find entity");
        }
    }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
0
 public static SafeFloat SqrDistance(SafeV3 a, SafeV3 b)
 {
     return((a - b).sqrMagnitude);
 }
Ejemplo n.º 7
0
 public static SafeFloat Distance(SafeV3 a, SafeV3 b)
 {
     return((a - b).magnitude);
 }
Ejemplo n.º 8
0
 protected void MoveByDir(int delta, SafeV3 dir)
 {
 }
Ejemplo n.º 9
0
    private void _Move(SafeV3 dir, SafeFloat speed)
    {
        SafeV3 offset = speed * dir;

        MoveOneStep(offset);
    }
Ejemplo n.º 10
0
 public void MoveOneStep(SafeV3 step)
 {
     this.HostEntity.LogicTran.position += step;
 }
Ejemplo n.º 11
0
 public MoveByDir(SafeV3 dir, int life, MoveOverCallback overCall, SafeFloat speed)
     : base(speed, overCall)
 {
     this._dir        = dir;
     this._lifeRemain = life;
 }
Ejemplo n.º 12
0
 public LogicTransform(LogicEntity entity, SafeV3 pos)
     : base(entity)
 {
     this.position = pos;
 }
Ejemplo n.º 13
0
 public void Move(SafeV3 dir)
 {
     this.position += dir;
 }
Ejemplo n.º 14
0
 public LogicGameObject(string resPath, SafeV3 initPos, bool syncLoad = false)
 {
     _isLoadedByMe = true;
     LoadObj(syncLoad);
     position = initPos;
 }