当前位置:网站首页>Unity card flipping effect
Unity card flipping effect
2022-07-05 04:56:00 【Meteor spot】
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class fanzhuan : MonoBehaviour
{
private Quaternion T;
private Quaternion V;
public GameObject A;// positive
public GameObject B;// Back //
// public GameObject C;
private bool bol = true;
void Start()
{
B.transform.rotation = Quaternion.Euler(0, 90, 0);
}
public void Init()
{
A.transform.rotation = Quaternion.Euler(0, 0, 0);
B.transform.rotation = Quaternion.Euler(0, 90, 0);
}
void Update()
{
// The following two lines are for him to rotate around himself //
// A.transform.Rotate(new Vector3(0, 90 * Time.deltaTime * 2.5f, 0));
//
//A.transform.Rotate(Vector3.down,3);
}
public void BtnClick()
{
if (bol)
{
// Init();
InvokeRepeating("BE", 0, 0.02f);
CancelInvoke("BD");
}
else
{
//Init();
InvokeRepeating("BD", 0.5f, 0.02f);
CancelInvoke("BE");
}
}
private void BE()
{
// C.transform.GetComponent<Button>().enabled = false;
T = Quaternion.Euler(0, 90, 0);
V = Quaternion.Euler(0, 0, 0);
A.transform.rotation = Quaternion.RotateTowards(A.transform.rotation, T,6f);
if (A.transform.eulerAngles.y > 89 && A.transform.eulerAngles.y < 91)
{
B.transform.rotation = Quaternion.RotateTowards(B.transform.rotation, V,6f);
bol = false;
// C.transform.GetComponent<Button>().enabled = true;
}
}
private void BD()
{
// Return action
// C.transform.GetComponent<Button>().enabled = false;
T = Quaternion.Euler(0, 90, 0);
V = Quaternion.Euler(0, 0, 0);
B.transform.rotation = Quaternion.RotateTowards(B.transform.rotation, T, 6f);
if (B.transform.eulerAngles.y > 89 && B.transform.eulerAngles.y < 91)
{
// Add this judgment because it is written 90 degree , But it can't be directly 90 Degree integer , So I added such a judgment
A.transform.rotation = Quaternion.RotateTowards(A.transform.rotation, V, 6f);
bol = true;
//C.transform.GetComponent<Button>().enabled = true;
}
}
}
边栏推荐
- PostgreSQL surpasses mysql, and the salary of "the best programming language in the world" is low
- [LeetCode] 整数反转【7】
- stm32Cubemx(8):RTC和RTC唤醒中断
- LeetCode之单词搜索(回溯法求解)
- Minor spanning tree
- Flink集群配置
- 3dsmax snaps to frozen objects
- 2020-10-27
- Manually implement heap sorting -838 Heap sort
- Rip notes [rip three timers, the role of horizontal segmentation, rip automatic summary, and the role of network]
猜你喜欢
【Leetcode】1352. 最后 K 个数的乘积
On-off and on-off of quality system construction
Special information | finance, accounting, audit - 22.1.23
UE4/UE5 虚幻引擎,材质篇,纹理,Compression and Memory压缩和内存
xss注入
LeetCode之单词搜索(回溯法求解)
AutoCAD - command repetition, undo and redo
[groovy] closure (closure parameter binding | curry function | rcurry function | ncurry function | code example)
Unity check whether the two objects have obstacles by ray
Recherche de mots pour leetcode (solution rétrospective)
随机推荐
Unity intelligent NPC production -- pre judgment walking (method 1)
Autocad-- dynamic zoom
mysql審計日志歸檔
UE4/UE5 虚幻引擎,材质篇(三),不同距离的材质优化
2021 Higher Education Club Cup mathematical modeling national tournament ABCD problem - problem solving ideas
Special information | real estate and office buildings - 22.1.9
Thematic information | carbon, carbon neutrality, low carbon, carbon emissions - 22.1.9
LeetCode之單詞搜索(回溯法求解)
Unity find the coordinates of a point on the circle
中国针状焦行业发展研究与投资价值报告(2022版)
Difference between singleton and factory pattern
China polyurethane rigid foam Market Research and investment forecast report (2022 Edition)
Out and ref functions of unity
How to choose a panoramic camera that suits you?
#775 Div.1 B. Integral Array 数学
C4D simple cloth (version above R21)
54. 螺旋矩阵 & 59. 螺旋矩阵 II ●●
3dsmax common commands
[Business Research Report] top ten trends of science and technology and it in 2022 - with download link
【Leetcode】1352. Product of the last K numbers