Complete C# Unity Game Developer 2D

01 - Introduction & Setup

001 Welcome To The Course

02 - Delivery Driver (New Unity 2021.1 Content)

001 Section Intro - Delivery Driver

002 Game Design - Delivery Driver

003 Introducing Methods

胶囊脚本

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Driver : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
    }

    // Update is called once per frame
    void Update()
    {
        transform.Rotate(0, 0, 0.1f);
    }
}

004 Transform.Translate()

    void Update()
    {
        // 旋转
        transform.Rotate(0, 0, 0.1f);
        // 移动: x是左右, y是上下
        transform.Translate(0, .01f, 0);
    }

005 Introducing Variables

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Driver : MonoBehaviour
{
    private float steerSpeed = 0.1f;
    private float moveSpeed = 0.01f;

    // Start is called before the first frame update
    void Start()
    {
    }

    // Update is called once per frame
    void Update()
    {
        // 旋转
        transform.Rotate(0, 0, steerSpeed);
        // 移动: x是左右, y是上下
        transform.Translate(0, moveSpeed, 0);
    }
}

006 How To Use SerializeField


  目录