mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
25 lines
633 B
C#
25 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);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|