示例#1
0
        public static DUnit Create(Entity domain, DUnitInfo unitInfo)
        {
            DUnit tower = DUnitFactory.Create(domain, unitInfo.UnitId);

            // 位置信息
            tower.Position = new Vector3(unitInfo.PX, unitInfo.PY, unitInfo.PZ);
            tower.Rotation = new Quaternion(unitInfo.RX, unitInfo.RY, unitInfo.RZ, unitInfo.RW);
            // 类型信息
            tower.AddComponent <UnitTypeComponent, UnitType>(UnitType.UnitTower);
            // 配置信息
            tower.AddComponent <UTowerConfigComponent, int>(unitInfo.ConfigId);
            // 运算者
            tower.AddComponent <OperationerComponent, long>(unitInfo.OperationerId);
            // 阵营信息
            tower.AddComponent <CampComponent, long, CampType>(unitInfo.GamerId, (CampType)unitInfo.Camp);
            // 数值信息
            TowerHelper.InitTowerNumberic(tower);
            // 血量恢复
            NumericComponent numeric = tower.GetComponent <NumericComponent>();

            tower.AddComponent <HPRegainComponent, int>(numeric.GetAsInt(NumericType.HPRegain));

            // 触发创建完成事件
            Game.EventSystem.Publish(new AppEventType.AfterTowerCreate()
            {
                Unit = tower
            }).Coroutine();

            return(tower);
        }
示例#2
0
        public static DUnit Create(Entity domain, DUnitInfo unitInfo)
        {
            DUnit trap = DUnitFactory.Create(domain, unitInfo.UnitId);

            // 位置信息
            trap.Position = new Vector3(unitInfo.PX, unitInfo.PY, unitInfo.PZ);
            trap.Rotation = new Quaternion(unitInfo.RX, unitInfo.RY, unitInfo.RZ, unitInfo.RW);
            // 类型信息
            trap.AddComponent <UnitTypeComponent, UnitType>(UnitType.UnitTrap);
            // 配置信息
            trap.AddComponent <UTrapConfigComponent, int>(unitInfo.ConfigId);
            // 运算者
            trap.AddComponent <OperationerComponent, long>(unitInfo.OperationerId);
            // 阵营信息
            trap.AddComponent <CampComponent, long, CampType>(unitInfo.GamerId, (CampType)unitInfo.Camp);
            // 旋转组件
            trap.AddComponent <TurnComponent>();
            // 数值信息
            TrapHelper.InitTrapNumberic(trap);

            // 触发创建完成事件
            Game.EventSystem.Publish(new AppEventType.AfterTrapCreate()
            {
                Unit = trap
            }).Coroutine();

            return(trap);
        }
示例#3
0
        public static DUnit Create(Entity domain, DUnitInfo unitInfo)
        {
            DUnit shell = DUnitFactory.Create(domain, unitInfo.UnitId);

            // 位置信息
            shell.Position = new Vector3(unitInfo.PX, unitInfo.PY, unitInfo.PZ);
            shell.Rotation = new Quaternion(unitInfo.RX, unitInfo.RY, unitInfo.RZ, unitInfo.RW);
            // 类型信息
            shell.AddComponent <UnitTypeComponent, UnitType>(UnitType.UnitShell);
            // 配置信息
            shell.AddComponent <UShellConfigComponent, int>(unitInfo.ConfigId);
            // 运算者
            shell.AddComponent <OperationerComponent, long>(unitInfo.OperationerId);
            // 阵营信息
            shell.AddComponent <CampComponent, long, CampType>(unitInfo.GamerId, (CampType)unitInfo.Camp);
            // 数值信息
            ShellHelper.InitShellNumberic(shell);

            // 触发创建完成事件
            Game.EventSystem.Publish(new AppEventType.AfterShellCreate()
            {
                Unit = shell
            }).Coroutine();

            return(shell);
        }
示例#4
0
        public static DUnit Create(Entity domain, DUnitInfo unitInfo)
        {
            DUnit role = DUnitFactory.Create(domain, unitInfo.UnitId);

            // 位置信息
            role.Position = new Vector3(unitInfo.PX, unitInfo.PY, unitInfo.PZ);
            role.Rotation = new Quaternion(unitInfo.RX, unitInfo.RY, unitInfo.RZ, unitInfo.RW);
            // 类型信息
            role.AddComponent <UnitTypeComponent, UnitType>(UnitType.UnitRole);
            // 配置信息
            role.AddComponent <URoleConfigComponent, int>(unitInfo.ConfigId);
            // 运算者
            role.AddComponent <OperationerComponent, long>(unitInfo.OperationerId);
            // 阵营信息
            role.AddComponent <CampComponent, long, CampType>(unitInfo.GamerId, (CampType)unitInfo.Camp);
            // 移动组件
            role.AddComponent <DMoveComponent>();
            // 旋转组件
            role.AddComponent <TurnComponent>();
            // 寻路组件
            role.AddComponent <PathComponent>();
            // 数值信息
            RoleHelper.InitRoleNumberic(role);
            // 技能组件
            role.AddComponent <SkillComponent>();

            // 触发创建完成事件
            Game.EventSystem.Publish(new AppEventType.AfterRoleCreate()
            {
                Unit = role
            }).Coroutine();

            return(role);
        }