| | |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using static AnimationStrings; |
| | | |
| | | [RequireComponent(typeof(SpriteRenderer))] |
| | | public class Tiling : MonoBehaviour |
| | |
| | | myTransform.position.z |
| | | ); |
| | | |
| | | // Adjust the new position so it fits with the BoxCollider2D size |
| | | // Adjust the new position based on whether y is positive or negative |
| | | float colliderHeight = GetComponent<BoxCollider2D>().size.y; |
| | | if (newPosition.y >= 0) |
| | | { |
| | | newPosition.y -= Mathf.Abs(newPosition.y) % colliderHeight; |
| | | } |
| | | else |
| | | { |
| | | newPosition.y += Mathf.Abs(newPosition.y) % colliderHeight; |
| | | } |
| | | |
| | | Transform newBuddy = Instantiate(myTransform, newPosition, myTransform.rotation); |
| | | Tiling buddyTiling = newBuddy.GetComponent<Tiling>(); |
| | | |