public void RegisterEntityWithBehaviourOfType(GameEntity entity, EntityBehaviourType behaviourType) { EntityBehaviour behaviour = behaviourRepository.Get(behaviourType); if (behaviour != null) { behaviour.RegisterEntityWithBehaviour(entity); } }
public bool RepositoryContains(EntityBehaviourType type) { if (behaviourRepository.RepositoryContains(type)) { return(true); } else { return(false); } }
public EntityBehaviourDefinition GetBehaviourDefinitionOfType(EntityBehaviourType behaviourType) { for (int i = 0; i < requiredBehaviours.Count; i++) { if (requiredBehaviours[i].behaviourType == behaviourType) { return(requiredBehaviours[i]); } } return(null); }
public void RemoveBehaviourOfType(EntityBehaviourType behaviourType) { if (Count() > 0) { IEnumerable all = GetAll(); foreach (EntityBehaviour item in all) { if (item.behaviourType == behaviourType) { RemoveAt(item.repositoryIndex); } } } }
public EntityBehaviour Get(EntityBehaviourType behaviourType) { if (Count() > 0) { IEnumerable all = GetAll(); foreach (EntityBehaviour item in all) { if (item.behaviourType == behaviourType) { return(item); } } } UnityEngine.Debug.Log("Unable to find requested behaviour type on entity"); return(null); }
public bool RepositoryContains(EntityBehaviourType behaviourType) { if (Count() > 0) { IEnumerable all = GetAll(); foreach (EntityBehaviour item in all) { if (item.behaviourType == behaviourType) { return(true); } } } return(false); }
public override EntityBehaviour AddBehaviourOfType(GameEntity entity, EntityBehaviourType type) { EntityBehaviour behaviour = new EntityBehaviour_Default(); /* switch (type) { * case EntityBehaviourType.Growable: * behaviour = new EntityBehaviour_Growable(); * break; * case EntityBehaviourType.Harvestable: * behaviour = new EntityBehaviour_Harvestable(); * break; * case EntityBehaviourType.Raining: * behaviour = new EntityBehaviour_Raining(); * break; * } */ return(behaviour); }
public EntityBehaviourDefinition AddBehaviourToEntityDefinition(EntityDefinition definition, EntityBehaviourType behaviourType) { for (int i = 0; i < definition.requiredBehaviours.Count; i++) { if (definition.requiredBehaviours[i].behaviourType == behaviourType) { return(definition.requiredBehaviours[i]); } } EntityBehaviourDefinition newDefinition = new EntityBehaviourDefinition_Default(); switch (behaviourType) { case EntityBehaviourType.Growable: newDefinition = new EntityBehaviourDefinition_Growable(100, 150); break; } definition.requiredBehaviours.Add(newDefinition); return(newDefinition); }
public abstract EntityBehaviour AddBehaviourOfType(GameEntity entity, EntityBehaviourType behaviourType);
public void RemoveBehaviourOfType(EntityBehaviourType behaviourType) { behaviourRepository.RemoveBehaviourOfType(behaviourType); }