Пример #1
0
        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));
            }
        }
Пример #2
0
        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));
            }
        }