ECS架构 Entitas-CSharp学习之路(三)

第三个教程 -实现一个多反应系统

教程地址

https://github.com/sschmid/Entitas-CSharp/wiki/MultiReactiveSystem-Tutorial

配置

打开之前的Entitas编辑器,就是之前用来generate的那个。
在那个Jenny->Context 配置Game, Input, Ui,然后generate
加入教程所说的DestroyedComponent组件,Generate.
我之前用的是1.4.0,一直在报错,说array out of range,怕是因为不能识别多个属性,然后换成1.4.2版本的Entitas就没事了。

MultiDestroySystem

官方代码有问题,是这样的

using System.Collections.Generic;
using Entitas;
using Entitas.Unity;
using UnityEngine;

// IDestroyed: "I'm an Entity, I can have a DestroyedComponent"
public interface IDestroyEntity : IEntity, IDestroyedEntity{ }

// tell the compiler that our context-specific entities implement IDestroyed
public partial class GameEntity : IDestroyEntity { }
public partial class InputEntity : IDestroyEntity { }
public partial class UiEntity : IDestroyEntity { }

// inherit from MultiReactiveSystem using the IDestroy
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值