unity【动画】脚本_角色动画控制器 c#

首先创建一个代码文件夹Scripts

从人物角色Player的基类开始   创建IPlayer类

首先我们考虑到如果不挂载MonoBehaviour需要将角色设置成预制体实例化到场景上十分麻烦,

所以我们采用继承MonoBehaviour类的角色基类方法写代码

也就是说这个脚本直接绑定在角色物体身上,就不需要实例化了,相对降低了复杂程度。

首先我们需要在unity场景制作一个Renderer类型的目标点

首先创建一个平面Plane改名为MovementTargetSign

修改位置

移除掉碰撞器

添加一个材质 

对材质进行修改 点击Shader选项

选择一个纹理

代码:

using UnityEngine;
//抽象角色类-包括玩家和NPC
public class IPlayer : MonoBehaviour{
    protected Animator _animator;//动画器组件引用
    private IWeapon _weapon = null;//武器的引用
}

public class IWeapon{

}

using UnityEngine;
public class Player : IPlayer{
    private Renderer movementSign;//移动标志
    private Collider attackPlane;//攻击区
    private Collider floorPlane;//普通地面(非攻击区)
    private Vector3 lookatPos;//面向位置
    private float rotSpeed = 20f;//移动旋转速度
    private float attackRotSpeed = 10f;//攻击旋转速度
}

public class FemaleWarrior : Player{

}
将FemaleWarrior代码挂载Player对象身上

对角色Player添加胶囊碰撞器

调整胶囊碰撞器位于角色中心

再添加刚体

关掉 使用重力Use Gravity 勾选

在约束上constraints 冻结旋转 x y z

如果制作的角色不需要重力则用碰撞器实现,

如果制作的角色需要重力    则用刚体   实现

先用刚体实现:

代码如下:

using UnityEngine;
//抽象角色类-包括玩家和NPC
public class IPlayer : MonoBehaviour{
    protected Animator _animator;//动画器组件引用
    private IWeapon _weapon = null;//武器的引用
}

public class IWeapon{

}

using UnityEngine;
public class Player : IPlayer{
    private Renderer movementSign;//移动标志
    private Collider attackPlane;//攻击区
    private Collider floorPlane;//普通地面(非攻击区)
    private Vector3 lookatPos;//面向位置
    private float rotSpeed = 20f;//移动旋转速度
    private float attackRotSpeed = 10f;//攻击旋转速度
    protected virtual void Awake() {
        //移动标志
        if (movementSign == null)
            movementSign = GameObject.Find("MovementTargetSign").GetComponent<Renderer>();
    }
    protected virtual void Start(){
        //移动标志默认放在玩家脚下
        movementSign.transform.position = transform.position + new Vector3(0,0.02f,0);
        movementSign.enabled = false;//关闭移动标志的显示
    }
    //跟随鼠标旋转
    public void RotateWithCursorPos() {
        RaycastHit hit;
        //构建一条从摄像机到鼠标位置的射线
        var Ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        if (Physics.Raycast(Ray, out hit)) {
            //计算方向
            Vector3 mousePos = new Vector3(hit.point.x, transform.position.y, hit.point.z);
            Vector3 playerDirection = mousePos - transform.position;
            if (playerDirection != Vector3.zero) {
                //旋转到目标方向
                transform.rotation = Quaternion.Slerp(transform.rotation,
                    Quaternion.LookRotation(playerDirection), Time.deltaTime * attackRotSpeed);
            }
        }
    }
    protected virtual void Update() {
        RotateWithCursorPos();
    }
}

public class FemaleWarrior : Player{
    protected override void Awake(){
        base.Awake();
    }
    protected override void Start(){
        base.Start();
    }
}
完成人物转向之后,开始做人物移动功能

首先添加代码,将动画机参数转换为哈希值

using UnityEngine;
public class AnimaterConsteantVelues {
    public static int WeaponID = Animator.StringToHash("WeaponID");
    public static int isCombat = Animator.StringToHash("isCombat");
    public static int isIdle = Animator.StringToHash("isIdle");
    public static int Attack = Animator.StringToHash("Attack");
}
在角色基类中添加函数

using UnityEngine;
//抽象角色类-包括玩家和NPC
public class IPlayer : MonoBehaviour{
    protected Animator _animator;//动画器组件引用
    private IWeapon _weapon = null;//武器的引用
    public IWeapon Weapon {
        get => _weapon;
        set => _weapon = value;
    }
    public void Attack() {
        if (_weapon != null)
            _weapon.Attack();
    }
}
修改抽象武器基类

using UnityEngine;
public abstract class IWeapon{
    public string WeaponName { get; set; }
    protected GameObject _weaponModel;
    protected GameObject _weaponPrefab;
    private int weaponID { get; set; }
    protected IPlayer _player { get; set; }
    public GameObject WeaponPrefab {
        get => _weaponModel; 
        set => _weaponModel = value;
    }
    public virtual void Attack() { }
    public virtual void RefreshLine() { }
    public IWeapon(int weaponID, string name, string weaponModelPath, IPlayer player){
        this.weaponID = weaponID;
        WeaponName = name;
        _player = player;
        if (weaponModelPath != "") {
            _weaponModel = Resources.Load<GameObject>(weaponModelPath);
            if (_weaponModel != null) {
                var weaponPos = ((Player)_player).handleWeaponPosList[weaponID];
                _weaponPrefab = GameObject.Instantiate(_weaponModel, weaponPos.position, weaponPos.rotation);
                _weaponPrefab.transform.SetParent(weaponPos);
                _weaponPrefab.SetActive(false);
            }
        }
    }
}
修改角色子类

using System.Collections.Generic;
using UnityEngine;
public class Player : IPlayer{
    private Renderer movementSign;//移动标志
    private Collider attackPlane;//攻击区
    private Collider floorPlane;//普通地面(非攻击区)
    private Vector3 lookatPos;//面向位置
    private float rotSpeed = 20f;//移动旋转速度
    private float attackRotSpeed = 10f;//攻击旋转速度
    private float fallSpeed;
    //列表
    [SerializeField]
    public List<Transform>handleWeaponPosList = new List<Transform>();
    protected virtual void Awake() {
        _animator = GetComponent<Animator>();
        floorPlane = GameObject.Find("Plane").GetComponent<Collider>();
        //移动标志
        if (movementSign == null)
            movementSign = GameObject.Find("MovementTargetSign").GetComponent<Renderer>();
    }
    protected virtual void Start(){
        //移动标志默认放在玩家脚下
        movementSign.transform.position = transform.position + new Vector3(0,2f,0);
        movementSign.enabled = false;//关闭移动标志的显示
    }
    //跟随鼠标旋转
    public void RotateWithCursorPos() {
        RaycastHit hit;
        //构建一条从摄像机到鼠标位置的射线
        var Ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        if (Physics.Raycast(Ray, out hit)) {
            //计算方向
            Vector3 mousePos = new Vector3(hit.point.x, transform.position.y, hit.point.z);
            Vector3 playerDirection = mousePos - transform.position;
            if (playerDirection != Vector3.zero) {
                //旋转到目标方向
                transform.rotation = Quaternion.Slerp(transform.rotation,
                    Quaternion.LookRotation(playerDirection), Time.deltaTime * attackRotSpeed);
            }
        }
    }
    public void Move(){
        RaycastHit hit;
        var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        if (Input.GetMouseButton(0)){
            if (floorPlane.Raycast(ray, out hit, 50f)){
                movementSign.transform.position = hit.point + new Vector3(0, 0.01f, 0);
                movementSign.enabled = true;
                lookatPos = hit.point;
            }
        }
        else if(Input.GetMouseButtonUp(1)){
            _animator.SetBool(AnimaterConsteantVelues.isCombat, true);
            _animator.SetTrigger(AnimaterConsteantVelues.Attack);
            Attack();
        }
        lookatPos.y = transform.position.y;
        var playerDirection = lookatPos - transform.position;
        if (playerDirection != Vector3.zero) 
            transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(playerDirection), Time.deltaTime * rotSpeed);
        var offset = movementSign.transform.position - transform.position;
        var sqrDistance = offset.sqrMagnitude;
        if (sqrDistance > 0.1f){
            _animator.SetBool(AnimaterConsteantVelues.isIdle, false);
            rotSpeed = 20f;
        }
        else {
            _animator.SetBool(AnimaterConsteantVelues.isIdle,true);
            movementSign.enabled = false;
            movementSign.transform.position = transform.position;
            rotSpeed = 0;
        }
        var bodyRay = new Ray(transform.position + transform.up, transform.up * -1);
        if (floorPlane.Raycast(bodyRay, out hit, 1.0f)) {
            if (hit.point.y > transform.position.y + 0.02f)
                transform.position = hit.point + new Vector3(0, 0.02f, 0);
            else if (floorPlane.Raycast(bodyRay, out hit, 1.2f))
                if (hit.point.y > transform.position.y - 0.02f) 
                    transform.position = hit.point + new Vector3(0, -0.02f, 0);
            else {
                fallSpeed += 0.1f;
                var v = new Vector3(0, fallSpeed * Time.deltaTime, 0);
                transform.position -= v;
                movementSign.transform.position = transform.position + new Vector3(0, 0.01f, 0);
            }
        }
    }
    protected virtual void Update() {
        RotateWithCursorPos();
        Move();
    }
}

回到Unity场景中拖拽填充武器刷新

人物移动完成

接下来完成背包系统 

放进预制体包后完全解压缩

调整好Slot0-4的背景位置,将四个子物体预制体包后删除

子物体位置都改成0

隐藏/取消激活

接下来完成拾取道具

加碰撞器

调节碰撞器

加触发器

加刚体

修改名字

创建脚本

using JetBrains.Annotations;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//可拾取道具
public class CanPickupItem : MonoBehaviour{
    public AudioClip pickUpSound;//拾取声音
    private void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Player")) {
            //播放声音
            if (pickUpSound != null)
                AudioSource.PlayClipAtPoint(pickUpSound,transform.position);
            //将本道具更新到背包列表中
            GameObject.FindGameObjectWithTag("InventoryUITag").GetComponent<InventoryManager>().ItemNames.Add(gameObject.name);
            Destroy(gameObject);

        }
    }
}
 

挂载脚本

同样挂载到手枪上

添加标签

创建脚本

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

public class InventoryManager : MonoBehaviour
{
    //道具名称列表
    public List<string> ItemNames = new List<string>();

}
 

给人物标签

标签

运行即可触发拾取道具

接下来做背包系统

首先这里不用字典代码,运用简单方式制作,前提必须保证道具 和 道具图片的英文名字存在包含关系

在管理类中写一个打开背包的方法

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

public class InventoryManager : MonoBehaviour
{
    //道具名称列表
    public List<string> ItemNames = new List<string>();
    //打开或关闭背包
    public void OpenOrCloseInventoryUI(bool isOpen) {
        transform.Find("Panel").gameObject.SetActive(isOpen);
    }
}

using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting.Antlr3.Runtime;
using UnityEngine;
using UnityEngine.UI;

public class InventoryManager : MonoBehaviour
{
    //道具名称列表
    public List<string> ItemNames = new List<string>();
    //是否显示背包UI
    private bool isShowInventoryUI = false;
    //打开或关闭背包
    public void OpenOrCloseInventoryUI(bool isOpen) {
        transform.Find("Panel").gameObject.SetActive(isOpen);
    }
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.B)) {
            isShowInventoryUI = !isShowInventoryUI;
            //打开或关闭UI
            OpenOrCloseInventoryUI(isShowInventoryUI);
        }
    }
}

即可实现背包按B键开关背包UI

接下来我们需要做一个背包图标的UI,点击UI也能打开背包

即完成鼠标点击显隐背包UI 及 键盘B键显隐背包UI

接下来做UI文本更新,意义不大可省略,存在的意义在于完善体系

using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class InventoryManager : MonoBehaviour{
    //道具名称列表
    public List<string> ItemNames = new List<string>();
    //是否显示背包UI
    private bool isShowInventoryUI = false;
    //UI界面中的文本
    public Text[] textUI;
    //激活或关闭背包UI显示
    public void OpenOrCloseInventoryUI(bool isOpen) {
        transform.Find("Panel").gameObject.SetActive(isOpen);
        //更新文本
        UpdateInventoryTextUI();
    }
    private void Update(){
        if (Input.GetKeyDown(KeyCode.B))
            InventoryUIState();
    }
    //打开或关闭背包
    public void InventoryUIState() {
        isShowInventoryUI = !isShowInventoryUI;
        //打开或关闭UI
        OpenOrCloseInventoryUI(isShowInventoryUI);
    }
    //更新文本UI 
    private void UpdateInventoryTextUI(){
        for(int i = 0;i< ItemNames.Count;i++)
            textUI[i].text = ItemNames[i];
    }
}

调整文本在背包UI中的位置

取消激活面板

using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class InventoryManager : MonoBehaviour{
    public List<string> ItemNames = new List<string>();//道具名称列表
    private bool isShowInventoryUI = false;//是否显示背包UI
    public Text[] textUI;//UI界面中的文本
    public Image[] availableItemIcons;//可以获取的道具图标
    public void OpenOrCloseInventoryUI(bool isOpen){//激活或关闭背包UI显示
        transform.Find("Panel").gameObject.SetActive(isOpen);
        UpdateInventoryTextUI(); //更新文本
        UpdateInventoryIconUI();//更新图标
    }
    private void Update(){
        if (Input.GetKeyDown(KeyCode.B))
            InventoryUIState();
    }
    public void InventoryUIState(){//打开或关闭背包
        isShowInventoryUI = !isShowInventoryUI;
        OpenOrCloseInventoryUI(isShowInventoryUI);//打开或关闭UI
    }
    private void UpdateInventoryTextUI(){//更新文本UI 
        for (int i = 0;i < ItemNames.Count;i++)
            textUI[i].text = ItemNames[i];
    }
    private void UpdateInventoryIconUI(){//更新图标UI
        for (int i = 0; i < ItemNames.Count; i++){
            Image itemIcon = GetIconPrefabByItemName(ItemNames[i]);//根据道具名称返回对应的图标
            if (itemIcon != null){
                Image newItemIcon = Instantiate(itemIcon);//将图标克隆到对应的Image中
                newItemIcon.transform.SetParent(textUI[i].transform.parent);//更改父物体
                RectTransform rt = newItemIcon.GetComponent<RectTransform>();//调整位置
                rt.anchoredPosition = Vector3.zero;
            }
            else
                Debug.LogError("没找到对应图标");
        }
    }
    private Image GetIconPrefabByItemName(string name){//根据道具名称返回对应的图标
        for (int i = 0; i < availableItemIcons.Length; i++){
            if (availableItemIcons[i].name.Contains(name))
                return availableItemIcons[i];
        }
        return null;
    }
}

隐藏文字部分

运行即完成

挂移动摄像机

using UnityEngine;
public class CameraMove : MonoBehaviour{ //第三人称摄像机简单版
    public Transform target;//摄像机的跟随目标
    public float distance = 8.0f;//摄像机与目标之间的距离
    private float x, y, z;
    private float xSpeed = 250.0f;
    private float ySpeed = 120.0f;
    public float yMinlimit = -45.0f;//限制上下移动角度
    public float yMaxlimit = 45.0f;
    private void Awake(){
        //注册场景加载完毕事件
        //EventCenter.AddListener(EventType.SceneLoadComplete, SetTarget);
    }
    private void SetTarget(){
        //将标签为Player的物体设置为跟踪目标
        Transform player = GameObject.FindGameObjectWithTag("Player").transform;
        if (player != null && target == null)
            target = player;
    }
    private void Start(){
        Vector3 angles = transform.eulerAngles;//获取摄像机的当前角度
        x = angles.x;
        y = angles.y;
        z = -distance;
        GoRight();
    }

    private void LateUpdate(){
        float temp = Input.GetAxis("Mouse ScrollWheel");//获取滚轮数值
        if (target != null){
            if (Input.GetMouseButton(0)){
                x += Input.GetAxis("Mouse X") * xSpeed * 0.02f;
                y -= Input.GetAxis("Mouse Y") * ySpeed * 0.02f;
            }
        }
        //钳制上下移动的角度
        y = ClampAngle(y,yMinlimit,yMaxlimit);
        z += temp * 100f * 0.02f;//数值按照自己喜好设定
        z = Mathf.Clamp(z,-20f,-3.0f);//距离限制,最远是距离玩家20米,最近是3米
        GoRight();//作用于摄像机
    }
    float ClampAngle(float angle,float min,float max){
        if (angle < -360)
            angle += 360;
        if (angle > 360)
            angle -= 360;
        return Mathf.Clamp(angle,min,max);
    }
    //摄像机控制位置及角度的核心方法
    void GoRight(){
        if (target == null)
            return;
        Quaternion rotation = Quaternion.Euler(y,x,0);//摄像机角度
        Vector3 position = rotation * new Vector3(0.0f,0.0f,z)+target.position;
        transform.position = position;//摄像机位置
        transform.rotation = rotation;//摄像机角度
    }
}

即完成摄像机跟随人物移动

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/117734.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

VBA之正则表达式(44)-- 拆分商品和规格

实例需求&#xff1a;商品组清单保存在A列中&#xff0c;现需要将其拆分为商品名称&#xff0c;保存在从B列开始的后续单元格中&#xff0c;部分商品包含规格&#xff0c;并且多种规格属性使用了逗号分隔&#xff0c;因此无法直接使用Excel分列功能完成数据拆分。 示例代码如下…

“第六十一天”

这三个也算一类的&#xff0c;减和加的处理差不多&#xff0c;不过这个题多了限制是被减数大于减数&#xff0c;要是想再完整一点&#xff0c;可以把小于的情况也考虑进去&#xff0c;不过这个我是如果被减数小于减数的话&#xff0c;我就用减数加被减数&#xff0c;然后最后打…

【MySQL数据库】 四

本文主要介绍了mysql数据库的几种常见的约束. 一.数据库约束 我们希望存储的数据是靠谱的,mysql提供一些机制来辅助我们自动的依赖程序对数据进行检查 . 这类查数据的机制,就是约束 一旦约束好了,后续在进行增 删 改的时候,mysql就会自动的对修改的数据做出检查,如果不符合…

wscat

wscat 是一个用于 WebSocket 通信测试的命令行工具 安装wscat flynnsinflynnsin:~$ sudo npm install -g wscat loadDep:ws → afterAdd ▄ ╢████████████████████████████████████░░░░░░░░░░░░░░░░░░░░░░░…

爱上C语言:函数递归,青蛙跳台阶图文详解

&#x1f680; 作者&#xff1a;阿辉不一般 &#x1f680; 你说呢&#xff1a;生活本来沉闷&#xff0c;但跑起来就有风 &#x1f680; 专栏&#xff1a;爱上C语言 &#x1f680;作图工具&#xff1a;draw.io(免费开源的作图网站) 如果觉得文章对你有帮助的话&#xff0c;还请…

大数据毕业设计选题推荐-旅游景点游客数据分析-Hadoop-Spark-Hive

✨作者主页&#xff1a;IT毕设梦工厂✨ 个人简介&#xff1a;曾从事计算机专业培训教学&#xff0c;擅长Java、Python、微信小程序、Golang、安卓Android等项目实战。接项目定制开发、代码讲解、答辩教学、文档编写、降重等。 ☑文末获取源码☑ 精彩专栏推荐⬇⬇⬇ Java项目 Py…

修复RGBA的png为RGB的png

修改IHDR里面的color type 修改IHDR的crc 删除sBit和sRGB两个chunk

linux中各种最新网卡2.5G网卡驱动,不同型号的网卡需要不同的驱动,整合各种网卡驱动,包括有线网卡、无线网卡、Wi-Fi热点

linux中各种最新网卡2.5G网卡驱动&#xff0c;不同型号的网卡需要不同的驱动&#xff0c;整合各种网卡驱动&#xff0c;包括有线网卡、无线网卡、自动安装Wi-Fi热点。 最近在做路由器二次开发&#xff0c;现在市面上卖的新设备&#xff0c;大多数都采用了2.5G网卡&#xff0c;…

crond服务

目录 一、crond服务基础知识 1、crond服务介绍 2、查看crond服务的状态 3、crond服务配置文件详解 4、额外的配置文件目录 二、crond服务基础命令 1、crond服务使用 2、 管理和操作 crond 服务 3、crond服务命令举例 一、crond服务基础知识 1、crond服务介绍 1、crond…

bug: https://aip.baidubce.com/oauth/2.0/token报错blocked by CORS policy

还是跟以前一样&#xff0c;我们先看报错点&#xff1a;&#xff08;注意小编这里是H5解决跨域的&#xff0c;不过解决跨域的原理都差不多&#xff09; Access to XMLHttpRequest at https://aip.baidubce.com/oauth/2.0/token from origin http://localhost:8000 has been blo…

HarmonyOS 数据管理与应用数据持久化(二)

通过键值型数据库实现数据持久化 场景介绍 键值型数据库存储键值对形式的数据&#xff0c;当需要存储的数据没有复杂的关系模型&#xff0c;比如存储商品名称及对应价格、员工工号及今日是否已出勤等&#xff0c;由于数据复杂度低&#xff0c;更容易兼容不同数据库版本和设备…

100量子比特启动实用化算力标准!玻色量子重磅发布相干光量子计算机

2023年5月16日&#xff0c;北京玻色量子科技有限公司&#xff08;以下简称“玻色量子”&#xff09;在北京正大中心成功召开了2023年首场新品发布会&#xff0c;重磅发布了自研100量子比特相干光量子计算机——“天工量子大脑”。 就在3个月前&#xff0c;因“天工量子大脑”在…

ModbusTcp通信(S7-1200PLC作为服务器端)

S7-200Smart plc作为ModbusTcp服务器端的通信 S7-200SMART PLC ModbusTCP通信(ModbusTcp服务器)_s7-200 modbustcp-CSDN博客文章浏览阅读2.3k次。S7-200SMART PLC 作为ModbusTCP通信(客户端)编程应用和程序详细讲解可以查看下面的博客,链接地址如下:S7-200SMART PLC Modbus…

你的停机真的优雅么?第二弹来袭 | 京东云技术团队

1. 前言 之前总结了一篇基于现有业务线在停机重启时会产生RPC和MQ调用强杀导致业务数据不一致文章&#xff0c;文中通过优雅停机改造对RPC服务进行反注册和MQ进行暂停消费&#xff0c;进而可以解决在停机时强制kill掉RPC线程或者MQ线程导致数据不一致现象&#xff0c;具体的原…

服务号能升级成订阅号吗

服务号和订阅号有什么区别&#xff1f;服务号转为订阅号有哪些作用&#xff1f;一、文章推送的篇数不同服务号在文章的推送篇数上是有所限制的&#xff08;每月推4次&#xff09;订阅号则每天可推送一篇文章。二、定义不同服务号主要是为关注用户提供服务使用的&#xff1b;订阅…

SQL数据库使用方法

首先打开sqlite3.exe所在文件夹&#xff0c;如图1 图1 在文件夹路径中将路径改为cmd&#xff0c;如图2所示 图2 在弹出的cmd窗口中输入如图3所示。 图3 sqlite3 tichiceliang.db 其中tichiceliang是数据库名称。然后按enter&#xff0c;再在cmd中输入.table,可以看到文件夹目…

一种使用wireshark快速分析抓包文件amr音频流的思路方法

解决方案&#xff1a; 1. 使用wireshark过滤amr,并导出原始数据文件&#xff1b; 2.使用ue的二进制编辑模式&#xff0c;编辑该文件&#xff0c;添加amr头&#xff0c;6个字节数据“#!AMR”&#xff0c;字节数据为 23 21 41 4D 52 0A 3.修正格式&#xff1a;通过抓包发现&#…

idea 将分支的代码合并到master

idea 将分支的代码合并到master 1. 首先签出到自己的分支 (自己的分支是自己写的代码&#xff0c;需要合并到master分支去&#xff09; 2. 然后选中master分支&#xff0c;右键选择 签出并变基到“feature_SC” &#xff0c;完成之后master分支中就已经是完整的代码了。 当…

基于生成对抗网络的照片上色动态算法设计与实现 - 深度学习 opencv python 计算机竞赛

文章目录 1 前言1 课题背景2 GAN(生成对抗网络)2.1 简介2.2 基本原理 3 DeOldify 框架4 First Order Motion Model5 最后 1 前言 &#x1f525; 优质竞赛项目系列&#xff0c;今天要分享的是 &#x1f6a9; 基于生成对抗网络的照片上色动态算法设计与实现 该项目较为新颖&am…

解决vue3父组件执行子组件方法报错:TypeError: Cannot read properties of null

现象&#xff1a; 父组件执行子组件的代码&#xff1a; 原因&#xff1a; Vue3使用的所有变量除了来自父组件传值的props以外&#xff0c;其他的html绑定的所有本地变量都必须通过return导出&#xff01; 这一点是vue3 最坑爹的一点。很容易忘记。 解决办法&#xff1a;使用t…
最新文章