当前位置:网站首页>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;
}
}
}
边栏推荐
- [Business Research Report] Research Report on male consumption trends in other economic times -- with download link
- C # perspective following
- Unity shot tracking object
- 775 Div.1 B. integral array mathematics
- XSS injection
- AutoCAD - workspace settings
- Cocos create Jiugongge pictures
- [groovy] closure (closure call | closure default parameter it | code example)
- Out and ref functions of unity
- Autocad-- dynamic zoom
猜你喜欢
Understand encodefloatrgba and decodefloatrgba
AutoCAD -- dimension break
django连接数据库报错,这是什么原因
On-off and on-off of quality system construction
2022 thinking of mathematical modeling C problem of American college students / analysis of 2022 American competition C problem
XSS injection
Autocad-- dynamic zoom
【acwing】836. Merge sets
The 22nd Spring Festival Gala, an immersive stage for the yuan universe to shine into reality
[groovy] closure (closure call | closure default parameter it | code example)
随机推荐
UE4/UE5 虚幻引擎,材质篇,纹理,Compression and Memory压缩和内存
UE 虚幻引擎,项目结构
UE4/UE5 虚幻引擎,材质篇(三),不同距离的材质优化
2021 higher education social cup mathematical modeling national tournament ABCD questions - problem solving ideas - Mathematical Modeling
[LeetCode] 整数反转【7】
Rip notes [rip three timers, the role of horizontal segmentation, rip automatic summary, and the role of network]
AutoCAD - scaling
Use assimp library to read MTL file data
Unity synergy
Recherche de mots pour leetcode (solution rétrospective)
775 Div.1 C. Tyler and strings combinatorial mathematics
Unity shot tracking object
2022/7/2做题总结
Is $20billion a little less? Cisco is interested in Splunk?
Research and forecast report on China's solution polymerized styrene butadiene rubber (SSBR) industry (2022 Edition)
2022 thinking of mathematical modeling D problem of American college students / analysis of 2022 American competition D problem
Leetcode word search (backtracking method)
Animation
54. Spiral matrix & 59 Spiral matrix II ●●
#775 Div.1 B. Integral Array 数学