File tree Expand file tree Collapse file tree 2 files changed +9
-9
lines changed
Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ MonoBehaviour:
9898 m_EditorClassIdentifier :
9999 health : 4
100100 newSheepThreshold : 4
101- moveToSheepThreshold : 1
101+ moveToSheepThreshold : 2
102102 moveToGrassThreshold : 1
103103 timeToMove : 2
104104 closeSheep : []
Original file line number Diff line number Diff line change @@ -176,25 +176,25 @@ void CheckPosition()
176176 {
177177 float xOffset = 0 ;
178178 float yOffset = 0 ;
179- if ( transform . position . x > maxDistance )
179+ if ( transform . localPosition . x > maxDistance )
180180 {
181181 //xOffset = transform.position.x - maxDistance;
182- xOffset = maxDistance - transform . position . x ;
182+ xOffset = maxDistance - transform . localPosition . x ;
183183 }
184- else if ( transform . position . x < minDistance )
184+ else if ( transform . localPosition . x < minDistance )
185185 {
186- xOffset = - transform . position . x ;
186+ xOffset = - transform . localPosition . x ;
187187 }
188188 if ( transform . position . y > minDistance )
189189 {
190- yOffset = - transform . position . y ;
190+ yOffset = - transform . localPosition . y ;
191191 }
192- else if ( transform . position . y < - maxDistance )
192+ else if ( transform . localPosition . y < - maxDistance )
193193 {
194- yOffset = - ( transform . position . y + maxDistance ) ;
194+ yOffset = - ( transform . localPosition . y + maxDistance ) ;
195195 }
196196
197- transform . position += new Vector3 ( xOffset , yOffset ) ;
197+ transform . localPosition += new Vector3 ( xOffset , yOffset ) ;
198198 }
199199
200200 public void SetHealth ( int value )
You can’t perform that action at this time.
0 commit comments