当前位置: 首页 > news >正文

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;//摄像机角度
    }
}

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

相关文章:

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

首先创建一个代码文件夹Scripts 从人物角色Player的基类开始 创建IPlayer类 首先我们考虑到如果不挂载MonoBehaviour需要将角色设置成预制体实例化到场景上十分麻烦&#xff0c; 所以我们采用继承MonoBehaviour类的角色基类方法写代码 也就是说这个脚本直接绑定在角色物体…...

Java代码如何对Excel文件进行zip压缩

1&#xff1a;新建 ZipUtils 工具类 package com.ly.cloud.datacollection.util;import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.net.URLEncoder; import ja…...

改进YOLO系列:12.Repulsion损失函数【遮挡】

1. RepLoss论文 物体遮挡问题可以分为类内遮挡和类间遮挡两种情况。类间遮挡产生于扎堆的同类物体,也被称为密集遮挡(crowd occlusion)。Repulsion损失函数由三个部分构成,yolov5样本匹配,得到的目标框和预测框-一对应第一部分主要作用:预测目标框吸引IOU最大的真实目标框,…...

win11网络连接正常,但是无法正常上网

前言&#xff1a; 这个是一个win11的bug&#xff0c;好多人都遇到了&#xff0c;在孜孜不倦的百度下&#xff0c;毫无收获&#xff0c;终于是在抖音上看到有人分享的经验而解决了这个问题。 找到internet选项&#xff0c;然后点击打开 选择连接 将代理服务器中&#xff0c;为…...

硬科技企业社区“曲率引擎”品牌正式发布

“曲率引擎”&#xff0c;是科幻作品中最硬核的加速系统&#xff0c;通过改变时空的曲率&#xff0c;可实现光速飞行甚至能够超越光速。11月3日&#xff0c;“曲率引擎&#xff08;warp drive&#xff09;”作为硬科技企业社区品牌&#xff0c;在2023全球硬科技创新大会上正式对…...

少儿编程 2023年9月中国电子学会图形化编程等级考试Scratch编程三级真题解析(判断题)

2023年9月scratch编程等级考试三级真题 判断题(共10题,每题2分,共20分) 19、运行程序后,“我的变量”的值为25 答案:对 考点分析:考查积木综合使用,重点考查变量和运算积木的使用 开始我的变量为50,执行完第二行代码我的变量变为49,条件不成立执行否则语句,所以…...

MCU常见通信总线串讲(二)—— RS232和RS485

&#x1f64c;秋名山码民的主页 &#x1f602;oi退役选手&#xff0c;Java、大数据、单片机、IoT均有所涉猎&#xff0c;热爱技术&#xff0c;技术无罪 &#x1f389;欢迎关注&#x1f50e;点赞&#x1f44d;收藏⭐️留言&#x1f4dd; 获取源码&#xff0c;添加WX 目录 前言一…...

LazyVim: 将 Neovim 升级为完整 IDE | 开源日报 No.67

curl/curl Stars: 31.5k License: NOASSERTION Curl 是一个命令行工具&#xff0c;用于通过 URL 语法传输数据。 核心优势和关键特点包括&#xff1a; 可在命令行中方便地进行数据传输支持多种协议 (HTTP、FTP 等)提供丰富的选项和参数来满足不同需求 kubernetes/ingress-n…...

想要搭建网站帮助中心,看这一篇指南就对了!

在现今互联网时代&#xff0c;除了让用户了解产品的功能和一些操作&#xff0c;很多企业都需要在网上进行信息的发布和产品销售等业务活动。而这就需要一个帮助中心&#xff0c;在用户遇到问题或者需要了解更多信息的时候&#xff0c;能够快速地解答他们的疑惑和提供响应的帮助…...

92.更新一些收藏的经验贴总结学习

一、JS相关 1.进制转换 &#xff08;1&#xff09;十进制转二进制 十进制数除2取余法&#xff1a;十进制数除2&#xff0c;余数为权位上的数&#xff0c;得到的商继续除2&#xff0c;直到商为0。最后余数从下往上取值。 &#xff08;2&#xff09;二进制转十进制 把二进制…...

mysql 问题解决 4

7、集群 7.1 日志 1、MySQL 中有哪些常见日志? MySQL 中有以下常见的日志类型: 错误日志(Error Log):记录 MySQL 服务器在运行过程中出现的错误信息。通用查询日志(General Query Log):记录所有连接到 MySQL 服务器的 SQL 查询语句。慢查询日志(Slow Query Log):…...

llama-7B、vicuna-7b-delta-v1.1和vicuna-7b-v1.3——使用体验

Chatgpt的出现给NLP领域带来了让人振奋的消息&#xff0c;可以很逼真的模拟人的对话&#xff0c;回答人们提出的问题&#xff0c;不过Chatgpt参数量&#xff0c;规模&#xff0c;训练代价都很昂贵。 幸运的是&#xff0c;出现了开源的一些相对小的模型&#xff0c;可以在本地或…...

深入理解JVM虚拟机第十九篇:JVM字节码中方法内部的结构和与局部变量表中变量槽的介绍

大神链接:作者有幸结识技术大神孙哥为好友,获益匪浅。现在把孙哥视频分享给大家。 孙哥链接:孙哥个人主页 作者简介:一个颜值99分,只比孙哥差一点的程序员 本专栏简介:话不多说,让我们一起干翻JVM 本文章简介:话不多说,让我们讲清楚虚拟机栈存储结构和运行原理 文章目…...

windows好玩的cmd命令

颜色 后边的数字查表吧,反正我是喜欢一个随机的数字 color 01MAC getmac /v更新主机IP地址 通过DHCP更新 ipconfig /release ipconfig /renew改标题 title code with 你想要的标题...

线扫相机DALSA--常见问题四:修改相机参数,参数保存无效情况

该问题是操作不当&#xff0c;未按照正常步骤保存参数所致&#xff0c;相机为RAM机制&#xff0c;参数需保存在采集卡的ROM内。 保存参数步骤&#xff1a; ①首先将相机参数保存至User Set1&#xff1b; ②然后回到Board(采集卡)参数设置区&#xff0c;鼠标选中Basic Timing&a…...

linux中用date命令获取昨天、明天或多天前后的日期

在实际操作中&#xff0c;一些脚本中会调用明天&#xff0c;或者昨天&#xff0c;或更多天前的日期&#xff0c;本文将叙述讲述用date命令实现时间的显示。在Linux系统中用man date -d 查询的参数说的比较模糊&#xff0c;以下举例进一步说明&#xff1a; # man date -d, --da…...

【无标题】360压缩软件怎么用?超级好用!

360压缩是一款功能强大的解压缩软件&#xff0c;如何用它压缩文件呢&#xff1f;下面给出了详细的操作步骤。 一、360压缩详细步骤 1、下载软件后&#xff0c;在电脑上右击需要压缩的文件&#xff0c;在弹出的菜单中点击【添加到压缩文件】选项。 2、在360压缩窗口中按需设置相…...

一图搞懂傅里叶变换(FT)、DTFT、DFS和DFT之间的关系

自然界中的信号都是模拟信号&#xff0c;计算机无法处理&#xff0c;因此我们会基于奈奎斯特定理对模拟信号采样得到数字信号。 但是我们发现&#xff0c;即便是经过采样&#xff0c;在时域上得到了数字信号&#xff0c;而在频域上还是连续信号。 因此我们可以在时域中选取N点…...

行情分析——加密货币市场大盘走势(11.7)

大饼昨日下跌过后开始有回调的迹象&#xff0c;现在还是在做指标修复&#xff0c;大饼的策略保持逢低做多。稳健的依然是不碰&#xff0c;目前涨不上去&#xff0c;跌不下来。 以太昨天给的策略&#xff0c;依然有效&#xff0c;现在以太坊开始回调。 目前来看&#xff0c;回踩…...

阿里微服务质量保障系列:故障演练

对于很多大型企业(如阿里巴巴)来说,经过多年的技术演进,系统工具和架构已经高度垂直化,服务器规模也达到了比较大的体量。当服务规模大于一定量(如10000台)时,小概率的硬件故障每天都会发生。这时如果需要人的干预,系统就无法可靠的伸缩。 为此每一层的系统都会面向失…...

eNSP-Cloud(实现本地电脑与eNSP内设备之间通信)

说明&#xff1a; 想象一下&#xff0c;你正在用eNSP搭建一个虚拟的网络世界&#xff0c;里面有虚拟的路由器、交换机、电脑&#xff08;PC&#xff09;等等。这些设备都在你的电脑里面“运行”&#xff0c;它们之间可以互相通信&#xff0c;就像一个封闭的小王国。 但是&#…...

Linux 文件类型,目录与路径,文件与目录管理

文件类型 后面的字符表示文件类型标志 普通文件&#xff1a;-&#xff08;纯文本文件&#xff0c;二进制文件&#xff0c;数据格式文件&#xff09; 如文本文件、图片、程序文件等。 目录文件&#xff1a;d&#xff08;directory&#xff09; 用来存放其他文件或子目录。 设备…...

前端倒计时误差!

提示:记录工作中遇到的需求及解决办法 文章目录 前言一、误差从何而来?二、五大解决方案1. 动态校准法(基础版)2. Web Worker 计时3. 服务器时间同步4. Performance API 高精度计时5. 页面可见性API优化三、生产环境最佳实践四、终极解决方案架构前言 前几天听说公司某个项…...

为什么需要建设工程项目管理?工程项目管理有哪些亮点功能?

在建筑行业&#xff0c;项目管理的重要性不言而喻。随着工程规模的扩大、技术复杂度的提升&#xff0c;传统的管理模式已经难以满足现代工程的需求。过去&#xff0c;许多企业依赖手工记录、口头沟通和分散的信息管理&#xff0c;导致效率低下、成本失控、风险频发。例如&#…...

高防服务器能够抵御哪些网络攻击呢?

高防服务器作为一种有着高度防御能力的服务器&#xff0c;可以帮助网站应对分布式拒绝服务攻击&#xff0c;有效识别和清理一些恶意的网络流量&#xff0c;为用户提供安全且稳定的网络环境&#xff0c;那么&#xff0c;高防服务器一般都可以抵御哪些网络攻击呢&#xff1f;下面…...

AI病理诊断七剑下天山,医疗未来触手可及

一、病理诊断困局&#xff1a;刀尖上的医学艺术 1.1 金标准背后的隐痛 病理诊断被誉为"诊断的诊断"&#xff0c;医生需通过显微镜观察组织切片&#xff0c;在细胞迷宫中捕捉癌变信号。某省病理质控报告显示&#xff0c;基层医院误诊率达12%-15%&#xff0c;专家会诊…...

Kubernetes 网络模型深度解析:Pod IP 与 Service 的负载均衡机制,Service到底是什么?

Pod IP 的本质与特性 Pod IP 的定位 纯端点地址&#xff1a;Pod IP 是分配给 Pod 网络命名空间的真实 IP 地址&#xff08;如 10.244.1.2&#xff09;无特殊名称&#xff1a;在 Kubernetes 中&#xff0c;它通常被称为 “Pod IP” 或 “容器 IP”生命周期&#xff1a;与 Pod …...

算法打卡第18天

从中序与后序遍历序列构造二叉树 (力扣106题) 给定两个整数数组 inorder 和 postorder &#xff0c;其中 inorder 是二叉树的中序遍历&#xff0c; postorder 是同一棵树的后序遍历&#xff0c;请你构造并返回这颗 二叉树 。 示例 1: 输入&#xff1a;inorder [9,3,15,20,7…...

Linux安全加固:从攻防视角构建系统免疫

Linux安全加固:从攻防视角构建系统免疫 构建坚不可摧的数字堡垒 引言:攻防对抗的新纪元 在日益复杂的网络威胁环境中,Linux系统安全已从被动防御转向主动免疫。2023年全球网络安全报告显示,高级持续性威胁(APT)攻击同比增长65%,平均入侵停留时间缩短至48小时。本章将从…...

Python爬虫实战:研究Restkit库相关技术

1. 引言 1.1 研究背景与意义 在当今信息爆炸的时代,互联网上存在着海量的有价值数据。如何高效地采集这些数据并将其应用于实际业务中,成为了许多企业和开发者关注的焦点。网络爬虫技术作为一种自动化的数据采集工具,可以帮助我们从网页中提取所需的信息。而 RESTful API …...