Get Bool Object from other Entity

Hi :) How can I get a bool Object from other entity? Thanks :D

Best Answer

Answers

  • stanchion said:

    GetComponent("EntityController").state.boolObject;

    ty
  • DallasOnFire
    edited July 2015
    N
    stanchion said:

    GetComponent("EntityController").state.boolObject;

    No, if i do 'hit.transform.GetComponent(BoltEntity).state.Name' im getting ''state' is not a member of 'BoltEntity'. And if I do 'hit.transform.GetComponent("EntityController").state.Name' im getting 'state' is not a member of 'BoltEntity'. If a remove quotes im getting 'Unknown identifier: 'EntityController'. Help please :/
  • 'state' is not a member of BoltEntity, but of BoltBehaviour, which is an interface of whatever state you set on the boltentitiy object.

    Check out this tut:
    http://doc.photonengine.com/en/bolt/current/getting-started/bolt-102-properties-and-callbacks
  • BoltEntity item = obj.GetComponent<BoltEntity>(); IItemState itemState = item.GetState<IItemState>(); BoltLog.Info("ItemID: {0}", itemState.Id);
  • ddd said:

    BoltEntity item = obj.GetComponent<BoltEntity>(); IItemState itemState = item.GetState<IItemState>(); BoltLog.Info("ItemID: {0}", itemState.Id);

    I tried with:

    if (Physics.Raycast(ray, hit, distance)){
    if (hit.transform.tag == "Player"){
    NameText.GetComponent(UI.Text).text = hit.transform.GetComponent(BoltEntity).GetState(IPlayerState).Name;
    }
    }

    And im getting: 'Cannot infer generic arguments for method 'BoltEntity.GetState.()'. Provide stronger type information through arguments, or explicitly state the generic arguments.'
  • Manmax75
    Manmax75
    edited July 2015
    GetState is a generic method, you need to use the less than and greater signs to declare an explicit type for it. Otherwise the compiler gets all confused about what to do..
    So, like this:
    hit.transform.GetComponent(BoltEntity).GetState<IPlayerState>().Name

    Currently you have:
    hit.transform.GetComponent(BoltEntity).GetState(IPlayerState).Name

    It all has to do with the <> and ()