#Bit field Enums and GameObject names

1 messages · Page 1 of 1 (latest)

polar wyvern
#

Hey! I'm curious how to implement the following idea: Use bitwise enums to represent a combination of states, decide if name of a gameobject (eg collision.gameObject.name) matches any of the enums.

#

Currently:

// in initialization code
Scout scout = new Scout(ResourceType.Food & ResourceType.Curiosity);

// inside Scout object, ant and collision given from OnCollisionEnter()
public void UpdateStates(Ant ant, Collision collision)
{
 if (collision.gameObject.name in target)
        {
            ant.pheromoneState = PheromoneState.Complete;
            ant.antState = AntState.Idle;
        }
    }
}
#

the in is a guess/placeholder

#

looks like i want enum.HasFlag(flagValue)