repair camera calibrating + finish adding configs
This commit is contained in:
parent
ef6b345a03
commit
f9a54513cd
@ -572,7 +572,7 @@ MonoBehaviour:
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 519420028}
|
||||
m_Enabled: 0
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: e1e75c8792eeaf44a8afc3d3fa678c74, type: 3}
|
||||
m_Name:
|
||||
|
||||
@ -1,39 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class GlobalOffset : MonoBehaviour
|
||||
{
|
||||
private Vector2 oldOffset;
|
||||
[field:SerializeField]
|
||||
public Vector2 Offset { get; set; }
|
||||
|
||||
void Start()
|
||||
{
|
||||
oldOffset = Offset;
|
||||
}
|
||||
|
||||
private void OffsetChanged()
|
||||
{
|
||||
foreach (var obj in gameObject.scene.GetRootGameObjects())
|
||||
{
|
||||
Translate(obj.transform);
|
||||
}
|
||||
}
|
||||
void Translate(Transform transform)
|
||||
{
|
||||
foreach(Transform t in transform) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (oldOffset != Offset)
|
||||
{
|
||||
OffsetChanged();
|
||||
oldOffset = Offset;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9b1d84852c45a8f418185efb2a5fa1c9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -6,17 +6,22 @@ public class KeepLevelAnchored : MonoBehaviour
|
||||
{
|
||||
Camera _camera;
|
||||
Rect _levelBound;
|
||||
bool _boundCalculated = false;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
LevelManager.Instance.LevelLoaded += CalculateBound;
|
||||
CalculateBound(LevelManager.Instance.CurrentLevel);
|
||||
_camera = Camera.main;
|
||||
LevelManager.Instance.LevelLoaded += CalculateBound;
|
||||
|
||||
if (!LevelManager.Instance.CurrentLevel) return;
|
||||
CalculateBound(LevelManager.Instance.CurrentLevel);
|
||||
}
|
||||
|
||||
private void CalculateBound(GatherAndDefend.LevelEditor.Level level)
|
||||
{
|
||||
_boundCalculated = false;
|
||||
_levelBound = level.CalculateBounds();
|
||||
_boundCalculated = true;
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
@ -27,6 +32,7 @@ public class KeepLevelAnchored : MonoBehaviour
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (!_boundCalculated) return;
|
||||
//move right
|
||||
var xMax = _levelBound.xMax;
|
||||
var width = _camera.ScreenToWorldPoint(Vector2.one * _camera.pixelWidth).x;
|
||||
|
||||
@ -47,7 +47,7 @@ namespace GatherAndDefend.LevelEditor
|
||||
// if the function we receive is null, we just make it constant 1
|
||||
if (tileSpawnAcceleration == default) tileSpawnAcceleration = () => 1;
|
||||
|
||||
const int tilesPerSecond = 15;
|
||||
var tilesPerSecond = GlobalConfig.Instance.Current.baseTileSpawnSpeed;
|
||||
|
||||
reference.transform.localPosition = _position;
|
||||
reference.transform.localScale = _scale;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user