public void Activate(string Id, Vector2 from, Vector2 to) { var model = Pool.New(); model.OwnerId = Id; model.startPosition = from; model.transform.position = from; model.targetPosition = to; // todo if weapon move no linear, moveUnit needless, example: stone model, bezier curve model.moveUnit = UnityExtensions.CalculateDelta(from, to, Config.Speed); }
public void Initialization(int i, Vector2 position, Action <StoneSplash> disable) { Disable = disable; transform.position = position; if (i == 0) { target = position + 0.5f * Vector2.right; } if (i == 1) { target = position - 0.5f * Vector2.right; } if (i == 2) { target = position + 0.5f * Vector2.up; } if (i == 3) { target = position - 0.5f * Vector2.up; } afterInit = true; delta = UnityExtensions.CalculateDelta(transform.position, target, speed); }
public virtual void CalculateMoveUnit(Vector2 targetPosition) { moveUnit = UnityExtensions.CalculateDelta(transform.position, targetPosition, Core.Speed); }