3D 콘텐츠 제작

좀짓막(좀비 집짓고 막기) [#9] - 세부 조정 및 정리

송현호 2023. 10. 11. 12:23

 

 

맵을 좀 더 추가해주었다.

 

 

 

 

z축으로 설치되는 벽을 추가 하고 바리케이드에 기능을 넣어 줬다.

 

 

 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using static UnityEngine.GraphicsBuffer;

public class CameraCtrl : MonoBehaviour
{
    private GameObject target;

    private float scrollSum = 5;
    void Update()
    {
        float scroll = Input.GetAxis("Mouse ScrollWheel") * 15f;
        scrollSum -= scroll;
        float scrollSize = Mathf.Clamp(scrollSum, 1, 10);
        scrollSum = scrollSize;
        Camera.main.orthographicSize = scrollSize;

        if(target != null)
        {
            this.transform.position = new Vector3(this.target.transform.position.x-17, 15f, this.target.transform.position.z-17);
        }
        

    }

    public void Init(GameObject target)
    {
        this.target = target;
    }
}

 

카메라에 줌인 줌아웃 기능을 추가해주었다.

 

 

 

if(Time.time < 1)
        {
            this.timeText[0].text = 30.ToString("00");
        }
        else
        {
            this.timeText[0].text = Mathf.Floor(30 - (Time.time / 60)).ToString("00");
        }
        if(Mathf.CeilToInt(60 - (Time.time % 60)) == 60)
        {
            this.timeText[1].text = 0.ToString("00");
        }
        else
        {
            this.timeText[1].text = (60-(Time.time % 60)).ToString("00");
        }

 

 

타이머를 추가해주었다.

 

 

써놨던 여러 상수들을 변수로 바꿔서 확장성을 높여 줬다.