blob: 4184c2eb350ef558d6babc60be98f08ab6f0554c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
using UnityEngine;
namespace MontanaJohns.Core.Interfaces
{
public interface IFollowable
{
Transform ActorTransform { get; }
Camera MainCamera { get; }
public void Follow()
{
Vector3 pos = MainCamera.transform.position;
pos.x = Mathf.Lerp(ActorTransform.position.x, MainCamera.transform.position.x, 0.25f);
pos.y = Mathf.Lerp(ActorTransform.position.y, MainCamera.transform.position.y, 0.25f);
MainCamera.transform.position = pos;
}
}
}
|