-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathHideShowControlPanel.cs
49 lines (45 loc) · 1.2 KB
/
HideShowControlPanel.cs
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using Mono.Cecil.Cil;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
public class HideShowControlPanel : MonoBehaviour
{
// Start is called before the first frame update
public float hideTime = 3f;
private float timeStamp;
private Vector3 oriPos,hidePos;
private bool isVisible;
void Start()
{
oriPos = transform.position;
isVisible = true;
hidePos = oriPos + new Vector3(450, 0, 0);
}
// Update is called once per frame
void FixedUpdate()
{
Debug.Log(oriPos.ToString());
if (Replay.isOnReplay && timeStamp == 0)
{
timeStamp = Time.time;
}
if (Input.touchCount > 0)
{
timeStamp = Time.time;
transform.position = oriPos;
isVisible = true;
}
if (Time.time - timeStamp > hideTime && isVisible)
{
if (transform.position != hidePos){
// ÿ֡ÑØ×Å·½ÏòÒƶ¯ÎïÌå
transform.Translate(25,0,0);
}
else
{
isVisible = false;
}
}
}
}