/// <summary> /// Initializes a new instance of the <see cref="Damage"/> class. /// </summary> /// <param name="damage">The damage.</param> public Damage(DamageItem damage) { AreaCode = damage.Area.Code; TypeCode = damage.Type.Code; SeverityCode = damage.Severity.Code; Comment = damage.Description; }
///<summary> ///</summary> public void UpdateInformation(DamageItem directive, Aircraft currentAircarft) { _currentDirctive = directive; _currentAircraft = currentAircarft; UpdateInformation(); }
void OnTriggerEnter2D(Collider2D col) { if (invulnerable) { return; } if (col.gameObject.tag == "DamageZone") { DamageItem item = col.gameObject.GetComponent <DamageItem>(); if (healthBarForeground) { _currentHealth -= item.currentDamagePoints; if (_currentHealth <= 0) { GameObject.Destroy(transform.parent.gameObject); } else { if (animator) { animator.SetTrigger("damaged"); } Vector3 lScale = healthBarForeground.transform.localScale; lScale.x = _currentHealth / health; healthBarForeground.transform.localScale = lScale; Invoke("ResetInvulnerable", 0.5f); } } } }
///<summary> /// Создается объект, описывающий отображение добавления директивы ///</summary> /// <param name="directiveContainer">Родительский объект, в который добавляется директива</param> public DamageDirectiveScreen(BaseEntityObject directiveContainer) : this() { if (directiveContainer == null) { throw new ArgumentNullException("directiveContainer"); } if (directiveContainer is BaseComponent) { var baseComponent = (BaseComponent)directiveContainer; _currentBaseComponent = baseComponent; _currentDamage = new DamageItem { ParentBaseComponent = baseComponent }; } else { var aircraftFrame = GlobalObjects.ComponentCore.GetBaseComponentById(((Aircraft)directiveContainer).AircraftFrameId); _currentDamage = new DamageItem { ParentBaseComponent = aircraftFrame }; } Initialize(); }
private void HeaderControlButtonSaveAndAddClick(object sender, EventArgs e) { string message; if (!ValidateData(out message)) { message += "\nAbort operation"; MessageBox.Show(message, (string)new GlobalTermsProvider()["SystemName"], MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (GetChangeStatus()) { SaveData(false); } if (MessageBox.Show("Directive added successfully" + "\nClear Fields before add new directive?", new GlobalTermsProvider()["SystemName"].ToString(), MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { ClearFields(); } else { SetFieldsUnsaved(); } BaseComponent bd = _currentDamage.ParentBaseComponent; _currentDamage = new DamageItem { ParentBaseComponent = bd }; }
public MeleeAttackState(FinitStateMachine stateMachine, SkeletonData data) : base(stateMachine) { _animator = data.Animator; _target = data.Player; _damage = data.DamageItem; _attackDistance = data.AttackDistance; }
public DestroyShieldState(FinitStateMachine stateMachine, SkeletonData data) : base(stateMachine) { _animator = data.Animator; _damage = data.DamageItem; _attackCooldown = new WaitForSeconds(data.CooldownTime); _data = data; }
/// <summary> /// Сохраняет объект Directive в БД сохраняет если такой уже есть или создает новый если такой объект появляется первый раз /// </summary> /// <param name="directive">Принимает Directive</param> public void Save(Directive directive) { _newKeeper.Save(directive); foreach (AccessoryRequired accessoryRequired in directive.Kits) { accessoryRequired.ParentObject = directive; accessoryRequired.ParentId = directive.ItemId; _keeper.Save(accessoryRequired); } foreach (DirectiveRecord directiveRecord in directive.PerformanceRecords) { directiveRecord.Parent = directive; directiveRecord.ParentId = directive.ItemId; _newKeeper.Save(directiveRecord); } DamageItem damageItem = directive as DamageItem; if (damageItem == null || damageItem.DamageDocs.Count == 0) { return; } foreach (DamageDocument doc in damageItem.DamageDocs) { _newKeeper.Save(doc); } }
///<summary> ///</summary> public DamageChart2DForm(DamageItem directive, Aircraft currentAircarft) : this() { _currentDirctive = directive; _currentAircraft = currentAircarft; UpdateInformation(); }
///<summary> /// Создает страницу для отображения информации об одной директиве ///</summary> /// <param name="damage">Директива</param> public DamageDirectiveScreen(DamageItem damage) : this() { if (damage == null) { throw new ArgumentNullException("damage", "Argument cannot be null"); } _currentDamage = damage; Initialize(); }
///<summary> ///</summary> public DamageChartFileDialog(DamageItem directive, Aircraft currentAircarft) { _currentDirctive = directive; _currentAircraft = currentAircarft; _damageChartsFileControls = new List <DamageChartFileControlNew>(); _damageImagesFileControls = new List <DamageChartImageControl>(); InitializeComponent(); UpdateInformation(); }
public CdnReceivedDamage(DamageItem damage, string damageAt) : this() { CdnDamageId = damage.Id; AreaCode = damage.Area.Code; AreaDescription = damage.Area.Description; SeverityCode = damage.Severity.Code; SeverityDescription = damage.Severity.Description; TypeCode = damage.Type.Code; TypeDescription = damage.Type.Description; DamageAt = damageAt; }
public void Start() { base.Start(); DamageItem meleeAttack = ItemFactory.MeleeAttack(gameObject); Items.Add(meleeAttack); item = meleeAttack; currentRange = meleeAttack.range; DamageItem rangedAttack = ItemFactory.RangedAttack(gameObject); Items.Add(rangedAttack); }
public void ApplyDamage(DamageItem damage, float attackRadius) { var blastetColliders = Physics.OverlapSphere(transform.position, attackRadius); foreach (var collider in blastetColliders) { if (collider.TryGetComponent <Shield>(out var damagable)) { damagable.ApplyDamage(damage); } } }
public override void DisposeScreen() { CancelAsync(); if (AnimatedThreadWorker.IsBusy) { AnimatedThreadWorker.CancelAsync(); } AnimatedThreadWorker.Dispose(); _currentDamage = null; Dispose(true); }
/// <summary> /// Coroutine to avoid displaying too /// much text elements at the same time and overlaping /// each other. /// </summary> /// <param name="damageTextPrefab">GameObject - damage text gameobject instantiated from the object pool.</param> /// <returns>IEnumerator</returns> private IEnumerator DisplayRoutine() { int i = 0; while (i < _stack.Count) { DamageItem data = _stack[i]; _stack.RemoveAt(i); GameObject damageTextPrefab = _pool.SpawnPrefab(); if (damageTextPrefab != null) { damageTextPrefab.GetComponent <DamageText>().Display(data.enemyDamage, data.isCritic); } yield return(new WaitForSeconds(toWaitTillNext)); } _displayRoutine = null; }
public void ApplyDamage(DamageItem damage) { if (Health <= 0) { return; } TryDamageProtection(damage.Type, ref damage.Value); TryDamageHealth(damage.Value); if (Health > 0) { LivesValueChanged?.Invoke(); PerformOnDamage(); } else { OnDie?.Invoke(); PerformOnDie(); } }
///<summary> /// Создает экземпляр класса для отображения информации о директиве ///</summary> ///<param name="currentDirective"></param> public DamageGeneralInformationControl(DamageItem currentDirective) { if (null == currentDirective) { throw new ArgumentNullException("currentDirective", "Argument cannot be null"); } _currentDirective = currentDirective; InitializeComponent(); ataChapterComboBox.UpdateInformation(); AttachedFile adNofile = null; if (currentDirective.ADNoFile != null) { adNofile = currentDirective.ADNoFile; } fileControlADNo.UpdateInfo(adNofile, "Adobe PDF Files|*.pdf", "This record does not contain a file proving the AD No. Enclose PDF file to prove the compliance.", "Attached file proves the AD No."); AttachedFile sBfile = null; if (currentDirective.ServiceBulletinFile != null) { sBfile = currentDirective.ServiceBulletinFile; } fileControlSB.UpdateInfo(sBfile, "Adobe PDF Files|*.pdf", "This record does not contain a file proving the Service bulletin. Enclose PDF file to prove the compliance.", "Attached file proves the Service bulletin."); AttachedFile eOfile = null; if (currentDirective.EngineeringOrderFile != null) { eOfile = currentDirective.EngineeringOrderFile; } fileControlEO.UpdateInfo(eOfile, "Adobe PDF Files|*.pdf", "This record does not contain a file proving the Engineering order. Enclose PDF file to prove the compliance.", "Attached file proves the Engineering order."); }
public void SmartCoreFileTest_DamageItem() { var enviroment = GetEnviroment(); var damageItem = new DamageItem { InspectionDocumentsFile = new AttachedFile { FileName = "InspectionDocumentsFile.test" }, }; enviroment.NewKeeper.Save(damageItem); Assert.IsTrue(damageItem.ItemId > 0, "ItemId должен быть больше 0"); var forCheck = enviroment.Loader.GetObject <DamageItem>(new ICommonFilter[] { new CommonFilter <int>(BaseEntityObject.ItemIdProperty, damageItem.ItemId) }, true); enviroment.NewKeeper.Delete(damageItem); Assert.IsTrue(forCheck != null, "значение не должно быть null"); Assert.AreEqual(forCheck.Files.Count, 1, "Кол-во файлов должно быть 1"); Assert.IsTrue(forCheck.InspectionDocumentsFile != null); Assert.AreEqual(forCheck.InspectionDocumentsFile.FileName, "InspectionDocumentsFile.test"); }
/// <summary> /// Update damage value. /// </summary> /// <parma name="enemyDamage">float - enemy damage got to display</param> /// <param name="isCritic">bool - wheter the damage got is critic.False by default.</param> public void DisplayDamage(float enemyDamage, bool isCritic = false) { DamageItem data = new DamageItem(enemyDamage, isCritic); _stack.Add(data); }
/// <summary> /// Создает объект отображающий краткую информацию о директиве /// </summary> /// <param name="currentPrimaryDirective"></param> public DamageSummaryControl(DamageItem currentPrimaryDirective) : this() { _currentDamageItem = currentPrimaryDirective; UpdateInformation(); }
protected override void AnimatedThreadWorkerDoWork(object sender, DoWorkEventArgs e) { #region Загрузка элементов AnimatedThreadWorker.ReportProgress(0, "load directives"); try { if (_currentDamage.ItemId > 0 && _needReload) { _currentDamage = GlobalObjects.CasEnvironment.NewLoader.GetObject <DirectiveDTO, DamageItem>(new List <Filter>() { new Filter("ItemId", _currentDamage.ItemId), new Filter("DirectiveType", 12) }, true); } } catch (Exception ex) { Program.Provider.Logger.Log("Error while loading directives", ex); } if (AnimatedThreadWorker.CancellationPending) { e.Cancel = true; return; } #endregion #region Калькуляция состояния директив AnimatedThreadWorker.ReportProgress(40, "calculation of directives"); if (_needReload) { //GlobalObjects.PerformanceCalculator.GetNextPerformance(_currentDamage); GlobalObjects.MTOPCalculator.CalculateDirectiveNew(_currentDamage); } if (AnimatedThreadWorker.CancellationPending) { e.Cancel = true; return; } #endregion #region Фильтрация директив AnimatedThreadWorker.ReportProgress(70, "filter directives"); if (AnimatedThreadWorker.CancellationPending) { e.Cancel = true; return; } #endregion #region Сравнение с рабочими пакетами AnimatedThreadWorker.ReportProgress(90, "comparison with the Work Packages"); if (AnimatedThreadWorker.CancellationPending) { e.Cancel = true; return; } #endregion AnimatedThreadWorker.ReportProgress(100, "Complete"); }
/// <summary> /// Данные у директивы обновляются по введенным данным /// </summary> /// <param name="destinationDamageItem">Директива</param> /// <param name="changePageName">Менять ли название вкладки</param> public void ApplyChanges(DamageItem destinationDamageItem, bool changePageName) { textboxTitle.Focus(); if (destinationDamageItem == null) { throw new ArgumentNullException("destinationDamageItem"); } destinationDamageItem.ATAChapter = ATAChapter; if (destinationDamageItem.Title != Title) { destinationDamageItem.Title = Title; if (changePageName) { var caption = ""; if (destinationDamageItem.ParentBaseComponent != null) { var baseComponent = destinationDamageItem.ParentBaseComponent; if (baseComponent.BaseComponentTypeId == BaseComponentType.Frame.ItemId) { //у Frame всегда есть ParentAircraftId caption = $"{DestinationHelper.GetDestinationStringFromAircraft(baseComponent.ParentAircraftId, false, null)}. {destinationDamageItem.DirectiveType.CommonName}. {destinationDamageItem.Title}"; } else { if (baseComponent.ParentAircraftId > 0) { caption = $"{DestinationHelper.GetDestinationStringFromAircraft(baseComponent.ParentAircraftId, false, null)}. "; } else if (baseComponent.ParentStoreId > 0) { caption = $"{DestinationHelper.GetDestinationStringFromStore(baseComponent.ParentStoreId, null, true)}. "; } caption += baseComponent + ". " + destinationDamageItem.DirectiveType.CommonName + ". " + destinationDamageItem.Title; } } if (DisplayerRequested != null) { DisplayerRequested(this, new ReferenceEventArgs(null, ReflectionTypes.ChangeTextOfContainingDisplayer, caption)); } } } destinationDamageItem.HiddenRemarks = HiddenRemarks; destinationDamageItem.Threshold.EffectiveDate = EffectiveDate; destinationDamageItem.Applicability = Applicability; destinationDamageItem.CorrectiveAction = Corrective; destinationDamageItem.ServiceBulletinNo = ServiceBulletin; destinationDamageItem.EngineeringOrders = EngOrderNumber; destinationDamageItem.InspectionDocumentsNo = InspectionDocuments; destinationDamageItem.Description = Subject; destinationDamageItem.Remarks = Remarks; destinationDamageItem.DamageMeasure = comboBoxMeasure.SelectedItem as Measure; destinationDamageItem.DamageType = (DamageType)comboBoxDamageType.SelectedItem; destinationDamageItem.DamageClass = (DamageClass)comboBoxClass.SelectedItem; destinationDamageItem.Location = textBoxLocation.Text; destinationDamageItem.Number = textBoxDamageNumber.Text; destinationDamageItem.DamageDepth = (double)numericUpDownDepth.Value; destinationDamageItem.DamageDepthLimit = (double)numericUpDownDepthLimit.Value; destinationDamageItem.DamageLenght = (double)numericUpDownLenght.Value; destinationDamageItem.DamageLenghtLimit = (double)numericUpDownLenghtLimit.Value; destinationDamageItem.DamageWidth = (double)numericUpDownWidth.Value; destinationDamageItem.DamageWidthLimit = (double)numericUpDownWidthLimit.Value; destinationDamageItem.JobCard = lookupComboboxJobCard.SelectedItem as JobCard; if (fileControlSB.GetChangeStatus()) { fileControlSB.ApplyChanges(); destinationDamageItem.ServiceBulletinFile = fileControlSB.AttachedFile; } if (fileControlEO.GetChangeStatus()) { fileControlEO.ApplyChanges(); destinationDamageItem.EngineeringOrderFile = fileControlEO.AttachedFile; } if (fileControlADNo.GetChangeStatus()) { fileControlADNo.ApplyChanges(); destinationDamageItem.ADNoFile = fileControlADNo.AttachedFile; } if (fileControlInspectionDocs.GetChangeStatus()) { fileControlInspectionDocs.ApplyChanges(); destinationDamageItem.InspectionDocumentsFile = fileControlInspectionDocs.AttachedFile; } }
private void OnCollisionEnter2D(Collision2D collision) { if (isAI) { forceFoward = Vector2.zero; } if (collision.gameObject.tag == "Player") { if (!canMove) { return; } if (PhotonNetwork.isMasterClient) { if (collision.contacts.Length <= 0) { return; } ContactPoint2D cp = collision.contacts[0]; Vector2 newVelocity = Vector2.Reflect(-cp.relativeVelocity, cp.normal) + (cp.normal * 10f); int damage = CalculateDamage(lastVelocity, collision.relativeVelocity, collision.gameObject.GetComponent <PlayerController>().lastVelocity); gameObject.GetPhotonView().RPC("CollisionEvent", PhotonTargets.All, newVelocity, cp.point, damage); } } else if (collision.gameObject.tag == "DamageItem") { if (PhotonNetwork.isMasterClient) { if (collision.gameObject.GetComponent <PickedItem>().ownerID == ID) //如果是自己的道具就不用做事 { return; } if (collision.contacts.Length <= 0) { return; } ContactPoint2D cp = collision.contacts[0]; Vector2 newVelocity = Vector2.Reflect(-cp.relativeVelocity, cp.normal) + (cp.normal * 10f); DamageItem item = collision.gameObject.GetComponent <DamageItem>(); int damage = CalculateDamage(lastVelocity, collision.relativeVelocity, item.lastVelocity); gameObject.GetPhotonView().RPC("CollisionEvent", PhotonTargets.All, newVelocity, cp.point, damage); item.DestroyMe(); } } else if (collision.gameObject.tag == "FishTail") { if (PhotonNetwork.isMasterClient) { if (collision.gameObject.GetComponent <PickedItem>().ownerID == ID) //如果是自己的道具就不用做事 { return; } if (collision.contacts.Length <= 0) { return; } ContactPoint2D cp = collision.contacts[0]; Vector2 newVelocity = Vector2.Reflect(-cp.relativeVelocity, cp.normal) + (cp.normal * 15f); FishTail item = collision.gameObject.GetComponent <FishTail>(); int damage = CalculateDamage(lastVelocity, collision.relativeVelocity, item.lastVelocity); gameObject.GetPhotonView().RPC("CollisionEvent", PhotonTargets.All, newVelocity, cp.point, damage + 3); } } else { if (collision.contacts.Length <= 0) { return; } ContactPoint2D cp = collision.contacts[0]; playerRig.velocity = Vector3.Reflect(lastVelocity, cp.normal); playerRig.velocity += cp.normal * 2.0f; } }
public void AddAfflictionTo(DamageItem damageItem) { damageItem.Afflictions.Add(this); }