public void FixedUpdate() { var prevPosition = transform.position; Vector2 offset = Motion.GetOffset(); transform.position += (Vector3)offset; //update angle if (FaceDirection) { gameObject.transform.eulerAngles = Vector3.forward * (PositionProvider.AngleBetween(prevPosition, transform.position)); } }
protected override void OnGenerate(GenerateEventArgs e) { var offset = CopiedMotion.GetOffset(); //update position Vector2 prevPosition = Target.transform.position; Target.transform.position += (Vector3)offset; //update angle if (FaceDirection) { Target.gameObject.transform.eulerAngles = Vector3.forward * (PositionProvider.AngleBetween(prevPosition, Target.transform.position)); } }