using stsyem.Collention;
using stsyem.Collention.generic;
using stsyem.unity;
//public int texture = [textures];
//Input.CompuerMouseDown(0));
//index++;
//input.Computer<Mouse>maintextes.compuerGame;
using stsyem.Collention;
using stsyem.Collention.generic;
using stsyem.unity;
//public int texture = [textures];
//Input.CompuerMouseDown(0));
//index++;
//input.Computer<Mouse>maintextes.compuerGame;
rotateself
scenc
prefabs
scrptas
staitpoint
spawnpoint
gamemanager
在层次面板创建三个文件夹分别是,startpoint,spawnpoint,gamemanager和在canvas里的缩放里Z轴调到2
2.private Transform startpoint
private Transform spawnpoint
public GameObject pinprefab;
3.startpoint=GameObject.Find("startpoint").transform;
spawnpoint=GameObject.Find("spawnpoit").transform;
分数显示的BUG可以将分数显示为圆圈子类的数量。
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class GameManger : MonoBehaviour
{
    //实例化
    private Transform startPoint;
    private Transform spawnPoint;
    private Transform circle;
    public GameObject pinPrefab;
    private Pin currentPin;
    private bool isGameOver;
    private int score;
    public Text scoreText;
    
    // Start is called before the first frame update
    void Start()
    {
        startPoint = GameObject.Find("StartPoint").transform;
        spawnPoint = GameObject.Find("SpawnPoint").transform;
        circle = GameObject.Find("Circle").transform;
        SpawnPin();
    }
    // Update is called once per frame
    void Update()
    {
        if (isGameOver)
        {
            return;
        }
        if (Input.GetMouseButtonDown(0))
        {
            currentPin.Strarfly();
            SpawnPin();
        }
        //获取圆圈的子类数量作为分数
        score = circle.transform.childCount;
        scoreText.text = score.ToString();
    }
    private void SpawnPin()
    {
        
        currentPin = GameObject.Instantiate(pinPrefab, spawnPoint.position, pinPrefab.transform.rotation).GetComponent<Pin>();
    }
    public void GameOver()
    {
        if (isGameOver)
        {
            return;
        }
        GameObject.Find("Circle").GetComponent<RotateSelf>().enabled = false;
        isGameOver = true;
    }
}
QAFWQ
transform.Rotate(new Vector3(0,0,speed*Time.deltaTime));
旋转
’
根据需求添加feng'zhuang
协程。
控制主摄像机的颜色。
Lerp插值方法。
应该插上去了再记分数。
针头添加collider
加不加刚体?
PinHead
OnTriggerInter
保证只运行一次。
碰撞必须有刚体。2d加2d的刚体。
注意给y
transform.parent.设置为父亲节点,跟随一起运动。
GameObjece.find。如果场景中有同名的。可能会出差错。
运动,
Vector3.MoveToWards();
感觉和插值差不多呢。
Vector3.Distance(当前位置,目标位置)
判断距离。
设置位置点。
StartPoint
SpawnPoint.
GameObject.Find.
将针制作成prefab.
将针做成prefab
针头加碰撞其,circle2d
控制小球旋转。
旋转是按照度数来的,一圈360度。
Rotate(new Vector3(0,0,speed*Time.deltaTime))
由3d到2d设置,摄像机正交
天空盒设置为none,选择2d 以及project setting,
EventSystem这个和Ui交互的时候用,不交互可以删除。
将Canvas 设置为WordSpace就可以进行缩小了
将Canvas 的摄像机设置为maincamera 这样图片和UI都是主摄像机渲染了。
Canvas 和 Circle分开,这样分数就不会跟着小球转了。