public void AddMove(SafeV3 dir, int lifeTime, SafeFloat speed, MoveOverCallback overCall) { MoveByDir md = new MoveByDir(dir, lifeTime, overCall, speed); md.Init(); _allMoves.Add(md); }
public LogicGameObject(GameObject target, SafeV3 initPos) { _go = target; _transform = target.transform; position = initPos; _isLoadedByMe = false; }
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); } } } }
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"); } }
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); }
public static SafeFloat SqrDistance(SafeV3 a, SafeV3 b) { return((a - b).sqrMagnitude); }
public static SafeFloat Distance(SafeV3 a, SafeV3 b) { return((a - b).magnitude); }
protected void MoveByDir(int delta, SafeV3 dir) { }
private void _Move(SafeV3 dir, SafeFloat speed) { SafeV3 offset = speed * dir; MoveOneStep(offset); }
public void MoveOneStep(SafeV3 step) { this.HostEntity.LogicTran.position += step; }
public MoveByDir(SafeV3 dir, int life, MoveOverCallback overCall, SafeFloat speed) : base(speed, overCall) { this._dir = dir; this._lifeRemain = life; }
public LogicTransform(LogicEntity entity, SafeV3 pos) : base(entity) { this.position = pos; }
public void Move(SafeV3 dir) { this.position += dir; }
public LogicGameObject(string resPath, SafeV3 initPos, bool syncLoad = false) { _isLoadedByMe = true; LoadObj(syncLoad); position = initPos; }