|
@@ -29,9 +29,9 @@ public class DogCollisionController : MonoBehaviour
|
|
|
Debug.Log("collision other" + other.transform.position);
|
|
|
Vector3 direction = transform.position - other.transform.position;
|
|
|
Vector3 moveToLocation = this.transform.position + direction.normalized * 0.5f;
|
|
|
- if (moveToLocation.x < -5f){moveToLocation.x = -5f;}
|
|
|
- if (moveToLocation.x > 5f){moveToLocation.x = 5f;}
|
|
|
- if (moveToLocation.z > 5f){moveToLocation.z = 5f;}
|
|
|
+ if (moveToLocation.x < -5f) { moveToLocation.x = -5f; }
|
|
|
+ if (moveToLocation.x > 5f) { moveToLocation.x = 5f; }
|
|
|
+ if (moveToLocation.z > 5f) { moveToLocation.z = 5f; }
|
|
|
Debug.Log("collision moveToLocation" + moveToLocation);
|
|
|
|
|
|
GameObject thisDog = this.gameObject;
|
|
@@ -43,12 +43,13 @@ public class DogCollisionController : MonoBehaviour
|
|
|
// 如果狗正在睡觉,则不处理碰撞
|
|
|
// 只处理非睡觉状态下的碰撞
|
|
|
Debug.Log("dog move to location" + moveToLocation);
|
|
|
- {
|
|
|
- dog.moveToLocation = moveToLocation;
|
|
|
- dog.RandomMove();
|
|
|
- break;
|
|
|
+ {
|
|
|
+ dog.moveToLocation = moveToLocation;
|
|
|
+ dog.RandomMove();
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-}
|
|
|
+}
|