当前位置:网站首页>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;
}
}
}
边栏推荐
- Unity enables mobile phone vibration
- Thinking of 2022 American College Students' mathematical modeling competition
- Unity intelligent NPC production -- pre judgment walking (method 1)
- Sixth note
- 2020-10-27
- Out and ref functions of unity
- 2022 American College Students' mathematical modeling ABCDEF problem thinking /2022 American match ABCDEF problem analysis
- LeetCode之单词搜索(回溯法求解)
- Solution of circular dependency
- Chinese notes of unit particle system particle effect
猜你喜欢
![[groovy] closure (closure parameter binding | curry function | rcurry function | ncurry function | code example)](/img/90/0cf08ae6fea61891e3e1fdf29d310c.jpg)
[groovy] closure (closure parameter binding | curry function | rcurry function | ncurry function | code example)
![[groovy] closure closure (customize closure parameters | customize a single closure parameter | customize multiple closure parameters | specify the default value of closure parameters)](/img/92/937122b059b6f3a91ae0e0858685e7.jpg)
[groovy] closure closure (customize closure parameters | customize a single closure parameter | customize multiple closure parameters | specify the default value of closure parameters)
![[Business Research Report] top ten trends of science and technology and it in 2022 - with download link](/img/9f/4fc63fa7b0e9afc5dd638d4b599b2c.jpg)
[Business Research Report] top ten trends of science and technology and it in 2022 - with download link

AutoCAD - lengthening

AutoCAD - full screen display

AutoCAD - feature matching

Is $20billion a little less? Cisco is interested in Splunk?

How to choose a panoramic camera that suits you?

Introduce Hamming distance and calculation examples

Redis 排查大 key 的4种方法,优化必备
随机推荐
django连接数据库报错,这是什么原因
2022 thinking of mathematical modeling D problem of American college students / analysis of 2022 American competition D problem
猿人学第一题
MD5绕过
Research and investment forecast report of adamantane industry in China (2022 Edition)
Out and ref functions of unity
Thinking of 2022 American College Students' mathematical modeling competition
Special information | finance, accounting, audit - 22.1.23
Chinese notes of unit particle system particle effect
Rip notes [rip message security authentication, increase of rip interface measurement]
Sixth note
2021 electrician Cup - high speed rail traction power supply system operation data analysis and equivalent modeling ideas + code
C iterator
2022 thinking of Mathematical Modeling B problem of American college students / analysis of 2022 American competition B problem
[ideas] 2021 may day mathematical modeling competition / May Day mathematical modeling ideas + references + codes
54. 螺旋矩阵 & 59. 螺旋矩阵 II ●●
Leetcode word search (backtracking method)
Séparation et combinaison de la construction du système qualité
AutoCAD - Document Management
[groovy] closure (closure parameter list rule | default parameter list | do not receive parameters | receive custom parameters)