59 lines
1.2 KiB
C#
59 lines
1.2 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class PlayCtrl : MonoBehaviour
|
|
{
|
|
public GameObject camera;
|
|
public float speed;
|
|
float move = 0;
|
|
|
|
public Slider slider;
|
|
float summons;
|
|
|
|
public Animator anim;
|
|
|
|
private void Awake()
|
|
{
|
|
//ÃʱâÈ
|
|
summons = 0.1f;
|
|
slider.value = 0;
|
|
}
|
|
|
|
public void MoveCamera(float move)
|
|
{
|
|
this.move = move;
|
|
}
|
|
|
|
public void CtrlButton()
|
|
{
|
|
anim.SetTrigger("MoveUI");
|
|
}
|
|
private void Update()
|
|
{
|
|
float deltaTime = Time.deltaTime;
|
|
camera.transform.position += Vector3.left * speed * deltaTime * move;
|
|
if(camera.transform.position.x < -40)
|
|
{
|
|
camera.transform.position = new Vector3(-40, 0, -10);
|
|
}
|
|
if (camera.transform.position.x > 40)
|
|
{
|
|
camera.transform.position = new Vector3(40, 0, -10);
|
|
}
|
|
slider.value += Time.deltaTime / 30;
|
|
if(slider.value >= 1)
|
|
{
|
|
slider.value -= 1;
|
|
summons = 0.1f;
|
|
}
|
|
if(summons < slider.value)
|
|
{
|
|
Debug.Log("¼Òȯ");
|
|
summons += 0.2f;
|
|
}
|
|
|
|
}
|
|
}
|