Unity三道题学习笔记

这篇博客记录了在Unity中实现视频效果的思路,包括使用Unity自带的Animation和第三方插件。此外,还介绍了Python读取文件的基础知识,以及如何在Unity中创建游戏体力系统,详细解释了体力接口的设计和实现。
摘要由CSDN通过智能技术生成

**

题目:实现视频效果

**

  • 三张卡片叠在一起,以ABC为例,包含两种切换方式:A->C->A和A->B->A;
  • 动画可用其他手段辅助,比如Unity自带Animation,或第三方插件如DoTween;

GameObject.FindWithTag();
transform.SetSiblingIndex();
不知道就搜索。。。

DescriptionSets the sibling index.Use this to change the sibling index of the GameObject. If a GameObject shares a parent with other GameObjects and are on the same level (i.e. they share the same direct parent), these GameObjects are known as siblings. The sibling index shows where each GameObject sits in this sibling hierarchy.

Use SetSiblingIndex to change the GameObject’s place in this hierarchy. When the sibling index of a GameObject is changed, its order in the Hierarchy window will also change. This is useful if you are intentionally ordering the children of a GameObject such as when using Layout Group components.

Layout Groups will also visually reorder the group by their index. To read more about Layout Groups see AutoLayout.
To return the sibling index of a GameObject, see Transform.GetSiblingIndex.

在这里插入图片描述

动画为了不让他一开始就播,直接让默认指向一个empty,再由条件指向我们需要的动画。。

使用UI做的,因为不知道按钮怎么直接加到物体上,所以直接三张图片ABC加子物体按钮,默认排序从上到下ABC,当然面板中是CBA,下面盖住上面,

注意面板中Animation Event的不同

在这里插入图片描述

先点选动画的物体,再点选动画事件时,是这样

在这里插入图片描述

点选assets里的动画,再选事件是这样,

丑陋代码

public class ControlA : MonoBehaviour
{
   
	Animator anim;
	
	int AToBID;
	int ATOCID;

	GameObject objectB;
	GameObject objectC;

	private void Start()
	{
   
		anim=GetComponent<Animator>();
		
		AToBID=Animator.StringToHash("AToB");
		AToCID=Animator.StringToHahs
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值