public override void Initialize(Contexts contexts, IEntity entity) { base.Initialize(contexts, entity); _text = GetComponent <TextMeshProUGUI>(); if (_text == null) { throw new NullReferenceException("ScoreDisplayView - text is missing!"); } Scale = Vector3.one; _text.color = new Color(_text.color.r, _text.color.g, _text.color.b, 1.0f); if (_originalPos == Vector2.one * 1000) { _originalPos = rectTransform.anchoredPosition; } else { rectTransform.anchoredPosition = _originalPos; } Rotation = new Vector3(0, 0, Rand.game.Int(-15, 15)); LinkedEntity.isViewEnable = true; LinkedEntity.AddViewEnableListener(this); LinkedEntity.AddViewEnableRemovedListener(this); }
private LinkedEntity Clone(LinkedEntity source) { return(new LinkedEntity { EntityType = source.EntityType, SourceSystemName = source.SourceSystemName, SourceSystemId = source.SourceSystemId, Name = source.Name, Type = source.Type, SubType = source.SubType, Status = source.Status, OpenDate = source.OpenDate, CloseDate = source.CloseDate, Urn = source.Urn, Ukprn = source.Ukprn, Uprn = source.Uprn, CompaniesHouseNumber = source.CompaniesHouseNumber, CharitiesCommissionNumber = source.CharitiesCommissionNumber, AcademyTrustCode = source.AcademyTrustCode, DfeNumber = source.DfeNumber, LocalAuthorityCode = source.LocalAuthorityCode, ManagementGroupType = source.ManagementGroupType, ManagementGroupId = source.ManagementGroupId, ManagementGroupCode = source.ManagementGroupCode, ManagementGroupUkprn = source.ManagementGroupUkprn, ManagementGroupCompaniesHouseNumber = source.ManagementGroupCompaniesHouseNumber, LinkType = source.LinkType, LinkedBy = source.LinkedBy, LinkedReason = source.LinkedReason, LinkedAt = source.LinkedAt, }); }
public override void Initialize(Contexts contexts, IEntity entity) { base.Initialize(contexts, entity); _points = new List <Transform>() { _body.transform, _leftFootPole.transform, _leftFootTarget.transform, _rightFootPole.transform, _rightFootTarget.transform, _leftHandPole.transform, _leftHandTarget.transform, _rightHandPole.transform, _rightHandTarget.transform, }; _pointsPoses = new List <PosePointData>() { _poseConfig.Body, _poseConfig.LeftFootPole, _poseConfig.LeftFootTarget, _poseConfig.RightFootPole, _poseConfig.RightFootTarget, _poseConfig.LeftHandPole, _poseConfig.LeftHandTarget, _poseConfig.RightHandPole, _poseConfig.RightHandTarget }; LinkedEntity.AddAnyPoseValueListener(this); }
void RecalculateLOP() { LOP = Blood + Phlegm + YellowBile + BlackBile; if (DieOfUnbalance && LOP > 0) { float bloodRatio = Blood / LOP; float phlegmRatio = Phlegm / LOP; float yellowBileRatio = YellowBile / LOP; float blackBileRatio = BlackBile / LOP; if (bloodRatio > 0.6f || phlegmRatio > 0.6f || yellowBileRatio > 0.6f || blackBileRatio > 0.6f) { LinkedEntity.Destroy(); } else { // On compte le nombre de ratios au dessus de 0.4f. int overUnbalanceRatio = new[] { bloodRatio > 0.4f, phlegmRatio > 0.4f, yellowBileRatio > 0.4f, blackBileRatio > 0.4f }.Count(x => x); if (overUnbalanceRatio >= 2) { LinkedEntity.Destroy(); } } } else if (LOP == 0) { LinkedEntity.Destroy(); } }
void ExecuteCanalise() { if (CurrentSpell != null) { bool canCast = true; float[] costs = SpellsManager.GetSpellByID(CurrentSpell.GetSpell().ID).OnCastCosts; if (((HumorsComponent)LinkedEntity.GetComponent(typeof(HumorsComponent))).GetBlood() < costs[0]) { canCast = false; } if (((HumorsComponent)LinkedEntity.GetComponent(typeof(HumorsComponent))).GetPhlegm() < costs[1]) { canCast = false; } if (((HumorsComponent)LinkedEntity.GetComponent(typeof(HumorsComponent))).GetYellowBile() < costs[2]) { canCast = false; } if (((HumorsComponent)LinkedEntity.GetComponent(typeof(HumorsComponent))).GetBlackBile() < costs[3]) { canCast = false; } if (canCast) { ((HumorsComponent)LinkedEntity.GetComponent(typeof(HumorsComponent))).RemoveHumors(costs); CurrentSpell.ExecuteOnCanalise(); } else { ExecuteEnd(); Debugger.Log("Pas assez d'humeur par rapoort au coût de ce sort !"); } } }
private void Awake() { World world = Container.Resolve <World>(); world.Subscribe <CancelMessage>(delegate { if (!gameObject.activeSelf) { return; } Destroy(gameObject); }); world.Subscribe <SubmitMessage>(delegate { if (!gameObject.activeSelf) { return; } HandleComponent handle = LinkedEntity.Get <HandleComponent>(); handle.Entity.ApplyCommand(new ProcessActionCommand( handle.Action, LinkedEntity.Get <PositionComponent>().Value )); gameObject.SetActive(false); }); }
public override void Initialize(Contexts contexts, IEntity entity) { base.Initialize(contexts, entity); _rigidbody = GetComponent <Rigidbody>(); LinkedEntity.AddRigidbody(this); }
public override void Initialize(Contexts contexts, IEntity entity) { base.Initialize(contexts, entity); LinkedEntity.AddViewEnableListener(this); LinkedEntity.AddViewEnableRemovedListener(this); AddListener(); }
public override void Initialize(Contexts contexts, IEntity entity) { base.Initialize(contexts, entity); Enabled = false; LinkedEntity.isTutorial = true; LinkedEntity.AddViewEnableListener(this); LinkedEntity.AddViewEnableRemovedListener(this); }
public override LinkedEntity<MonsterTestBase> EditorDuplicate(LinkedEntity<MonsterTestBase> DerivedDuplicateInto = null) { MonsterTestState DuplicateInto = (MonsterTestState)DerivedDuplicateInto; if(DuplicateInto == null) { DuplicateInto = new MonsterTestState(); } return base.EditorDuplicate(DuplicateInto); }
public override void Initialize(Contexts contexts, IEntity entity) { base.Initialize(contexts, entity); _camera = GetComponent <Camera>(); LinkedEntity.isMainCamera = true; LinkedEntity.AddCamera(this); LinkedEntity.AddPosition(Position); AddDefaultListeners(); }
public override void Initialize(Contexts contexts, IEntity entity) { base.Initialize(contexts, entity); Enabled = false; LinkedEntity.isLevelProgressBar = true; LinkedEntity.AddViewEnableListener(this); LinkedEntity.AddViewEnableRemovedListener(this); var levelListenerEntity = contexts.gameState.CreateEntity(); levelListenerEntity.AddAnyCurrentLevelListener(this); }
public override void Initialize(Contexts contexts, IEntity entity) { base.Initialize(contexts, entity); _buttonsInteracteBuffer = new bool[_buttons.Length]; LinkedEntity.isViewEnable = false; LinkedEntity.isInteractable = false; OnInteractableRemoved(null); LinkedEntity.AddViewEnableListener(this); LinkedEntity.AddViewEnableRemovedListener(this); LinkedEntity.AddInteractableListener(this); LinkedEntity.AddInteractableRemovedListener(this); }
/// <summary> /// Queries a collection resource for a single item, async. /// </summary> /// <typeparam name="TOut">The type of the t out.</typeparam> /// <param name="objFunc">The object function.</param> /// <returns>Task<TOut[]>.</returns> public async Task <TOut> QueryAsync <TOut>(Func <IEnumerable <TCollection>, LinkedEntity <TOut> > objFunc) where TOut : class, ICrestResource <TOut> { CollectionResource <T, TCollection> collection = this; List <TCollection> list = collection.Items.ToList(); if (EveCrest.EnableAutomaticPaging) { while (collection.Next != null) { collection = await EveCrest.LoadAsync(collection.Next).ConfigureAwait(false); list.AddRange(collection.Items); } } LinkedEntity <TOut> item = objFunc.Invoke(list); return(await EveCrest.LoadAsync(item).ConfigureAwait(false)); }
void Cast(uint spellID, object target) { Spell s = SpellsManager.GetSpellByID(spellID); if (s != null) { bool canCast = true; float[] costs = s.OnCastCosts; if (LinkedEntity.GetComponent <HumorsComponent>() != null) { HumorsComponent humors = ((HumorsComponent)LinkedEntity.GetComponent(typeof(HumorsComponent))); if (humors.GetBlood() < costs[0]) { canCast = false; } else if (humors.GetPhlegm() < costs[1]) { canCast = false; } else if (humors.GetYellowBile() < costs[2]) { canCast = false; } else if (humors.GetBlackBile() < costs[3]) { canCast = false; } } if (canCast) { if (LinkedEntity.GetComponent <HumorsComponent>() != null) { LinkedEntity.GetComponent <HumorsComponent>().RemoveHumors(costs); } CurrentSpell = s.Cast(LinkedEntity, target); } else { Debugger.Log("Pas assez d'humeur par rapport au coût de ce sort !"); } } }
/// <summary> /// Appelle "OnSynch" de tous les Components implémentants IEntitySynchroniser de cette entité. /// Synchronise également la Position, la Rotation, la Cellule actuelle, /// la taille, et la hauteur. /// </summary> public void OnSynch() { if (SynchData == null) { Debugger.Log("ERREUR : le SynchData n'a pas été initialisé !", UnityEngine.Color.red); return; } // Synchronisation des propriétés basiques : LinkedEntity.Position = (BloodAndBileEngine.SerializableVector3)SynchData.GetSynchInfo("Position"); LinkedEntity.Rotation = (BloodAndBileEngine.SerializableQuaternion)SynchData.GetSynchInfo("Rotation"); LinkedEntity.SetCellID((int)SynchData.GetSynchInfo("CurrentCell")); LinkedEntity.Size = (float)SynchData.GetSynchInfo("Size"); LinkedEntity.Height = (float)SynchData.GetSynchInfo("Height"); // Synchronisation des Components // Pour chaque ComponentSynchronizationDataObject, on vérifie que l'entité // possède le component correspondant, puis on exécute le GetSynch() sur ce dernier. // Si l'entité n'a pas le component, on lui ajoute. foreach (ComponentSynchronizationDataObject componentData in SynchData.GetComponentSynchData()) { EntityComponent component = LinkedEntity.GetComponent(componentData.ComponentType); if (component != null) { if (component is IEntitySynchroniser) { ((IEntitySynchroniser)(component)).OnSynch(componentData); // On lance la synchronisation. } } else // On ajoute le component { component = LinkedEntity.AddComponent(componentData.ComponentType); if (component != null && component is IEntitySynchroniser) { ((IEntitySynchroniser)(component)).OnSynch(componentData); } } } }
// Met à jour l'objet "EntitySynchroniserObject" lié à cette instance. public override void Update(float deltaTime) { // A chaque synchronisation : récolte des données de synchronisation auprès de chaque // component de l'entité implémentant IEntitySynchroniser. // Ajoute également les informations de base de l'entité : Position, Rotation, Cellule actuelle, // taille, hauteur. // Synchronisation des Components. foreach (EntityComponent component in LinkedEntity.GetComponents()) { if (component is IEntitySynchroniser) { SynchData.SetComponentSynchInfo(component.GetType(), ((IEntitySynchroniser)component).GetSynchInfo()); } } // Synchronisation des infos de base SynchData.SetBasicSynchInfo("Position", LinkedEntity.Position); SynchData.SetBasicSynchInfo("Rotation", LinkedEntity.Rotation); SynchData.SetBasicSynchInfo("CurrentCell", LinkedEntity.CurrentCellID); SynchData.SetBasicSynchInfo("Size", LinkedEntity.Size); SynchData.SetBasicSynchInfo("Height", LinkedEntity.Height); }
/// <summary> /// Queries the asynchronous. /// </summary> /// <typeparam name="TOut">The type of the t out.</typeparam> /// <typeparam name="TParam">The type of the t parameter.</typeparam> /// <param name="objFunc">The object function.</param> /// <param name="param">The parameter.</param> /// <returns>Task<TOut>.</returns> public Task <TOut> QueryAsync <TOut, TParam>(Func <T, Href <TOut> > objFunc, LinkedEntity <TParam> param) where TOut : class, ICrestResource <TOut> where TParam : IQueryParameter <TParam> { return(EveCrest.LoadAsync(objFunc.Invoke(this as T), param)); }
/// <summary> /// Queries the specified object function. /// </summary> /// <typeparam name="TOut">The type of the t out.</typeparam> /// <typeparam name="TParam">The type of the t parameter.</typeparam> /// <param name="objFunc">The object function.</param> /// <param name="param">The parameter.</param> /// <returns>TOut.</returns> public TOut Query <TOut, TParam>(Func <T, Href <TOut> > objFunc, LinkedEntity <TParam> param) where TOut : class, ICrestResource <TOut> where TParam : IQueryParameter <TParam> { return(QueryAsync(objFunc, param).Result); }
/// <summary> /// Initializes a new instance of the <see cref="AutopilotWaypoint" /> class. /// </summary> public AutopilotWaypoint() { SolarSystem = new LinkedEntity <SolarSystem>(); }
/// <summary> /// Loads the specified URI. /// </summary> /// <typeparam name="T"></typeparam> /// <typeparam name="TParam">The type of the t parameter.</typeparam> /// <param name="uri">The URI.</param> /// <param name="param">The parameter.</param> /// <returns>T.</returns> public T Load <T, TParam>(Href <T> uri, LinkedEntity <TParam> param) where T : class, ICrestResource <T> where TParam : IQueryParameter <TParam> { return(LoadAsync(uri, param).Result); }
/// <summary> /// Loads the asynchronous. /// </summary> /// <typeparam name="T"></typeparam> /// <typeparam name="TParam">The type of the t parameter.</typeparam> /// <param name="uri">The URI.</param> /// <param name="param">The parameter.</param> /// <returns>Task<T>.</returns> public Task <T> LoadAsync <T, TParam>(Href <T> uri, LinkedEntity <TParam> param) where T : class, ICrestResource <T> where TParam : IQueryParameter <TParam> { return(uri == null ? Task.FromResult(default(T)) : getAsync <T>((createQueryString(uri.Uri, QueryParameters.GetParameterName <TParam>(), param.Href.ToString())))); }
private async Task <LinkedEntity> MapToEntityAsync(Establishment establishment, DateTime date, CancellationToken cancellationToken) { // Translate var translatedType = await _translation.TranslateEnumValueAsync(EnumerationNames.ProviderType, SourceSystemNames.GetInformationAboutSchools, establishment.EstablishmentTypeGroup.Code, cancellationToken); var translatedSubType = await _translation.TranslateEnumValueAsync(EnumerationNames.ProviderSubType, SourceSystemNames.GetInformationAboutSchools, establishment.TypeOfEstablishment.Code, cancellationToken); var translatedStatus = await _translation.TranslateEnumValueAsync(EnumerationNames.ProviderStatus, SourceSystemNames.GetInformationAboutSchools, establishment.EstablishmentStatus.Code, cancellationToken); // Build entity provider details var entity = new LinkedEntity { LinkedAt = DateTime.Now, LinkedBy = "HistoricalDataPreparer", EntityType = EntityTypeLearningProvider, SourceSystemName = SourceSystemNames.GetInformationAboutSchools, SourceSystemId = establishment.Urn.ToString(), Name = establishment.EstablishmentName, Type = translatedType, SubType = translatedSubType, Status = translatedStatus, OpenDate = establishment.OpenDate, CloseDate = establishment.CloseDate, Urn = establishment.Urn, Ukprn = establishment.Ukprn, Uprn = establishment.Uprn, CompaniesHouseNumber = establishment.CompaniesHouseNumber, CharitiesCommissionNumber = establishment.CharitiesCommissionNumber, AcademyTrustCode = establishment.Trusts?.Code, DfeNumber = $"{establishment.LA.Code}/{establishment.EstablishmentNumber}", LocalAuthorityCode = establishment.LA.Code, }; // Add management group details var group = establishment.Trusts != null && !string.IsNullOrEmpty(establishment.Trusts.Code) ? await _preparedGiasRepository.GetGroupAsync(long.Parse(establishment.Trusts.Code), date, cancellationToken) : null; if (group == null && establishment.Federations != null && !string.IsNullOrEmpty(establishment.Federations.Code)) { group = await _preparedGiasRepository.GetGroupAsync(long.Parse(establishment.Federations.Code), date, cancellationToken); } if (group != null) { var translatedGroupType = await _translation.TranslateEnumValueAsync( EnumerationNames.ManagementGroupType, SourceSystemNames.GetInformationAboutSchools, group.GroupType, cancellationToken); entity.ManagementGroupType = translatedGroupType; entity.ManagementGroupId = group.Uid.ToString(); entity.ManagementGroupCode = $"{translatedGroupType}-{group.Uid}"; entity.ManagementGroupUkprn = group.Ukprn; entity.ManagementGroupCompaniesHouseNumber = group.CompaniesHouseNumber; } else { var translatedGroupType = await _translation.TranslateEnumValueAsync( EnumerationNames.ManagementGroupType, SourceSystemNames.GetInformationAboutSchools, LocalAuthority.ManagementGroupType, cancellationToken); entity.ManagementGroupType = translatedGroupType; entity.ManagementGroupId = establishment.LA.Code; entity.ManagementGroupCode = $"{translatedGroupType}-{establishment.LA.Code}"; } // Return return(entity); }
public override void Initialise(BloodAndBileEngine.WorldState.WorldState worldState) { Mover = (EntityMover)LinkedEntity.GetComponent(typeof(EntityMover)); }
/// <summary> /// Initializes a new instance of the <see cref="UIMarketDetails" /> class. /// </summary> public UIMarketDetails() { ItemType = new LinkedEntity <ItemType>(); }
/// <summary> /// Initializes a new instance of the <see cref="ContactItem" /> class. /// </summary> public ContactItem() { Contact = new LinkedEntity <string>(); }