当前位置:网站首页>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;
}
}
}
边栏推荐
- 中国聚氨酯硬泡市场调研与投资预测报告(2022版)
- MySQL audit log archiving
- Recherche de mots pour leetcode (solution rétrospective)
- #775 Div.1 C. Tyler and Strings 组合数学
- 775 Div.1 C. Tyler and strings combinatorial mathematics
- Unity sends messages and blocks indecent words
- Chinese notes of unit particle system particle effect
- jmeter -- 分布式压测
- AutoCAD - isometric annotation
- Common database statements in unity
猜你喜欢
PostgreSQL surpasses mysql, and the salary of "the best programming language in the world" is low
【Leetcode】1352. Product of the last K numbers
54. Spiral matrix & 59 Spiral matrix II ●●
AutoCAD - graphic input and output
[Business Research Report] top ten trends of science and technology and it in 2022 - with download link
数论函数及其求和 待更新
AutoCAD -- dimension break
[groovy] closure (closure call | closure default parameter it | code example)
2021 Higher Education Club Cup mathematical modeling national tournament ABCD problem - problem solving ideas
Is $20billion a little less? Cisco is interested in Splunk?
随机推荐
数论函数及其求和 待更新
[groovy] closure (Introduction to closure class closure | closure parametertypes and maximumnumberofparameters member usage)
Use assimp library to read MTL file data
Difference between singleton and factory pattern
中国针状焦行业发展研究与投资价值报告(2022版)
Group counting notes (1) - check code, original complement multiplication and division calculation, floating point calculation
Unity synergy
AutoCAD - feature matching
Unity shot tracking object
Dotween usage records ----- appendinterval, appendcallback
Research and investment forecast report of adamantane industry in China (2022 Edition)
Leetcode word search (backtracking method)
54. 螺旋矩阵 & 59. 螺旋矩阵 II ●●
Database under unity
【acwing】836. Merge sets
Séparation et combinaison de la construction du système qualité
2022 U.S. college students' mathematical modeling e problem ideas / 2022 U.S. game e problem analysis
China as resin Market Research and investment forecast report (2022 Edition)
Unity3d learning notes
Pdf to DWG in CAD