rimworld-animation-studio/Assets/Scripts/GUI/SelfContained/Chaser.cs
AbstractConcept 757badf4f6 Code refactor
2022-10-27 00:56:04 -05:00

24 lines
633 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace RimWorldAnimationStudio
{
public class Chaser : MonoBehaviour
{
public GameObject target;
public bool chaseAlongX = true;
public bool chaseAlongY = false;
void Update()
{
if (target == null)
{ return; }
float x = chaseAlongX ? target.transform.position.x : transform.position.x;
float y = chaseAlongY ? target.transform.position.y : transform.position.y;
transform.position = new Vector3(x, y, 0f);
}
}
}