25 lines
713 B
C#
25 lines
713 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class MoveWithTileScript : MonoBehaviour
|
|
{
|
|
private TileManagerScript _TileManagerScript;
|
|
|
|
private void Awake()
|
|
{
|
|
_TileManagerScript = GameObject.FindGameObjectWithTag("Tile Manager").GetComponent<TileManagerScript>();
|
|
|
|
if (_TileManagerScript != null)
|
|
{
|
|
_TileManagerScript.MoveWithTile = this;
|
|
}
|
|
}
|
|
|
|
public void UpdatePos()
|
|
{
|
|
Vector3 newVector = new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z + _TileManagerScript.DistanceTiles);
|
|
gameObject.transform.position = newVector;
|
|
}
|
|
}
|