Example #1
0
 private void Update()
 {
     transform.position = _savePosition;
     if (mc.GetFacingRight())
     {
         transform.position = new Vector3(player.position.x + _offset.x, player.position.y, _offset.z);
         _savePosition      = transform.position;
     }
     else if (!mc.GetFacingRight())
     {
         transform.position = new Vector3(player.position.x - _offset.x, player.position.y, _offset.z);
         _savePosition      = transform.position;
     }
     else if (mc.GetStateUp())
     {
         transform.position = new Vector3(player.position.x, player.position.y + _offset.y, _offset.z);
         _savePosition      = transform.position;
     }
     else if (!mc.GetStateUp())
     {
         transform.position = new Vector3(player.position.x, player.position.y - _offset.y, _offset.z);
         _savePosition      = transform.position;
     }
     transform.position = _savePosition;
 }