summaryrefslogtreecommitdiff
path: root/Assets/Scripts/Scene/MainCamera.cs
blob: 45399cebb9ec37904b5486c2793702841c4514cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MainCamera : SingletonMB<MainCamera>
{
    public new Camera camera { get; private set; }

    public Vector3 offset = Vector3.zero;

    protected override void Awake()
    {
        base.Awake();
        camera = gameObject.GetComponent<Camera>();
    }

    void Update()
    {
        if (TestErika.Instance.erika.unitController == null)
        {
            return;
        }
        Vector3 pos = transform.position;
        pos.x = TestErika.Instance.erika.unitController.transform.position.x;
        pos.y = TestErika.Instance.erika.unitController.transform.position.y;
        transform.position = pos + offset;
    }

}