50 lines
1.1 KiB
C#
50 lines
1.1 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityStandardAssets.Characters.FirstPerson;
|
|
|
|
public class OperateState : MonoBehaviour
|
|
{
|
|
public FirstPersonController PersonCon;
|
|
public GameObject[] Objs;
|
|
|
|
private bool isFirstEnter;
|
|
|
|
void Start()
|
|
{
|
|
isFirstEnter = true;
|
|
}
|
|
public void EnterUIOpreation()//进入UI操作
|
|
{
|
|
PersonCon.enabled = false;
|
|
}
|
|
int i;
|
|
bool ifHasShow;
|
|
public void EnterRoleOpreation()//进入第一人称操作
|
|
{
|
|
ifHasShow = false;
|
|
for (i = 0; i < Objs.Length; i++)
|
|
if (Objs[i].activeSelf)
|
|
ifHasShow = true;
|
|
if (!ifHasShow)
|
|
PersonCon.enabled = true;
|
|
if (isFirstEnter)
|
|
{
|
|
GameMannage.instance.TruckInFactory();
|
|
isFirstEnter = false;
|
|
}
|
|
}
|
|
float dTime;
|
|
void OnGUI()
|
|
{
|
|
if (Input.GetKeyUp(KeyCode.Escape))
|
|
{
|
|
if (Time.time - dTime > 0.5f)
|
|
{
|
|
dTime = Time.time;
|
|
PersonCon.enabled = !PersonCon.enabled;
|
|
}
|
|
}
|
|
}
|
|
}
|