Unity入门教程之课程介绍

 目录

🎈课程介绍

🎈游戏开发 VS 游戏建模

🎈基础要求


🎈课程介绍

Unity,一款游戏引擎,主要用于开发3D游戏,如下图所示:

 常见的游戏引擎:

- Unity(C#)

- Unreal Engine(C++)

- Cocos Creator(JavaScript)

- Frostbite Engine、Source Engine、Cry Engine…


🎈游戏开发 VS 游戏建模

游戏开发,面向开发人员

游戏建模,面向美术人员,如下图所示:

CG建模软件:3Dmax、Maya、Blender、Cinema4D、ZBrushi…


🎈基础要求

本课程为零基础课程,不要求先学会其他的3D软件

Unity使用C#代码来实现游戏逻辑:

- 会C#/Java,直接学习,以下是一段C#代码,相信Java程序猿也没有压力

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

public class PlayerLogic : MonoBehaviour
{
    [Tooltip("子弹节点的预制体")]
    public GameObject bulletPrefab;
    
    [Tooltip("子弹节点的父节点")]
    public Transform bulletFolder;
    
    [Tooltip("子弹出生点")]
    public Transform firePoint;
    
    [Tooltip("开火间隔")]
    public float fireInterval = 0.1f;
    
    [Tooltip("平移速度")]
    public float moveSpeed = 0.1f;
    
    // Start is called before the first frame update
    void Start()
    {
        InvokeRepeating("fire", fireInterval, fireInterval);
    }
    
    // Update is called once per frame
    void Update()
    {
        float dx = 0;

        if (Input.GetKey(KeyCode.A))
        {
            dx = -moveSpeed;
        }
        
        if (Input.GetKey(KeyCode.D))
        {
            dx = moveSpeed;
        }
        this.transform.Translate(dx, 0, 0, Space.self);
    }
    private void Fire()
    {
        //实例化一个子弹节点
        GameObject node = Instantiate(bulletPrefab, bulletFolder);
        
        //把子弹移动到出生点位置
        node.transform.position = firePoint.position;
    }
}

- 不会编程, 建议先学Java

- 不想学编程, 建议学习Blender建模

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值