Giter Site home page Giter Site logo

com.bovinelabs.core's People

Contributors

tertle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

com.bovinelabs.core's Issues

Unit tests are visible in the project

Even though the package was imported through scoped registery the tests are still showing up in testing window which shouldn't happen. My assumption is that the assembly definition for BovineLabs.Core.Tests is missing UNITY_INCLUDE_TESTS define.

States componentes setup question

Hello,
So today I've spent trying to figure out the States core principles and usage.
Somewhat works, but not sure if components shouldn't be changing or I setup something wrong. From the source, I see there's an AddComponent and RemoveComponent inside StateModel.cs under the StateJob, so I would assume that the component should be changed as well, depending on the State (i.e. "CameraState").
The question arises in lack of example and explanation on how to setup the components. Let's say I've got a Baker, so should I only add State components like so?:

        Entity entity = GetEntity(TransformUsageFlags.Dynamic);
        AddComponent(entity, new GridCellVisualState());
        SetComponent(entity, new GridCellVisualState { Value = (byte)clearState });
        AddComponent(entity, new GridCellVisualStatePrevious { Value = (byte)clearState });

Or I should also add all of the states that I would register in the system?

    StateAPI.Register<GridCellVisualState, ArenaGridCellVisualState>(ref state, (byte)GridCellVisualStates.Arena, false);
    StateAPI.Register<GridCellVisualState, WorkshopGridCellVisualState>(ref state, (byte)GridCellVisualStates.Workshop, false);
    StateAPI.Register<GridCellVisualState, BarracksGridCellVisualState>(ref state, (byte)GridCellVisualStates.Barracks, false);
   //... the whole list of states to register

So then the Baker would look like so:

        Entity entity = GetEntity(TransformUsageFlags.Dynamic);
        AddComponent(entity, new GridCellVisualState());
        SetComponent(entity, new GridCellVisualState { Value = (byte)clearState });
        AddComponent(entity, new GridCellVisualStatePrevious { Value = (byte)clearState });

        AddComponent(entity, new ArenaGridCellVisualState());
        AddComponent(entity, new WorkshopGridCellVisualState());
        AddComponent(entity, new BarracksGridCellVisualState());

TBH I tried both, but neither work, hence my issue post here.

To be more precise, here's the problem:
When I trigger the change for all components in query (in my case via):
ecb.SetComponent(selectedEntity, new GridCellVisualState { Value = OrderToState(order.ValueRW) });

I can see the Byte value in GridCellVisualState change, but not the actual components. If I understand correctly, the whole purpose for this Core submodule is to change components as well. So what am I doing wrong?


For context StateModel is setted up almost identically as in the example:

public partial struct GridCellStateSystem : ISystem, ISystemStartStop
{
    private StateModel impl;

    [BurstCompile]
    public void OnStartRunning(ref SystemState state)
    {
        this.impl = new StateModel(ref state, ComponentType.ReadWrite<GridCellVisualState>(), 
        ComponentType.ReadWrite<GridCellVisualStatePrevious>());
    }

    [BurstCompile]
    public void OnStopRunning(ref SystemState state)
    {
        this.impl.Dispose(ref state);
    }

    [BurstCompile]
    public void OnUpdate(ref SystemState state)
    {
        var ecb = new EntityCommandBuffer(state.WorldUpdateAllocator); // This can't be CommandBuffer System if prefered
        this.impl.Run(ref state, ecb);
        ecb.Playback(state.EntityManager);
    }
}

Cool library BTW, gonna try other stuff as well. Tried SpacialMap, complicated, but works great :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.