2263人加入学习
(8人评价)
如何开发一款火爆全网的游戏 - 羊了个羊(第一季)

制作完成于2022年10月31日,基于Unity2022.1

价格 免费

/*关于四只羊的图片翻转

*0节点 Vector3.zero

*6节点 new Vector3(0,180,0)

*创建的10个移动节点,代码判断如下

*/

 

void Start()
{
    Init();
    transform.DOPath(_movePoints, 10).SetEase(Ease.Linear).OnWaypointChange(x =>
    {
        transform.eulerAngles = x switch
        {
            0 => Vector3.zero,
            6 => new Vector3(0, 180, 0)
        };
    });
}
[展开全文]

using System.Collections; using System.Collections.Generic; using UnityEngine; using DG.Tweening; using UnityEngine.UI; using UnityEngine.SceneManagement; using UnityEngine.Purchasing.Extension; public class SheepMove : MonoBehaviour { public RectTransform rt; public Transform[] movePointsTrans; private Vector3[] movePoints; public bool loadSecen; private AsyncOperation ao; // Start is called before the first frame update void Start() { movePoints = new Vector3[movePointsTrans.Length]; for (int i = 0; i < movePoints.Length; i++) { movePoints[i] = movePointsTrans[i].localPosition; } if (loadSecen) { ao = SceneManager.LoadSceneAsync(1); ao.allowSceneActivation = false; } transform.DOLocalPath(movePoints, 3).SetEase(Ease.Linear).OnComplete ( () => { if (loadSecen) { ao.allowSceneActivation = true; } } ); } // Update is called once per frame void Update() { if (rt.anchoredPosition.y>=0) { transform.eulerAngles = new Vector3(0,180,0); } else { transform.eulerAngles = Vector3.zero; } } }

[展开全文]

授课教师

SiKi学院老师

课程特色

视频(11)
下载资料(3)