/// <summary> /// Copy data from current action and convert relative box position with fighter position /// </summary> private void ApplyCurrentActionData() { Hitboxes.Clear(); Hurtboxes.Clear(); foreach (HitboxData hitbox in fighterData.Actions[CurrentActionID].GetHitboxData(CurrentActionFrame)) { Hitbox box = new Hitbox { Rect = TransformToFightRect(hitbox.rect, Position, IsFaceRight), Proximity = hitbox.proximity, AttackID = hitbox.attackID }; Hitboxes.Add(box); } foreach (HurtboxData hurtbox in fighterData.Actions[CurrentActionID].GetHurtboxData(CurrentActionFrame)) { Hurtbox box = new Hurtbox(); Rect rect = hurtbox.useBaseRect ? fighterData.baseHurtBoxRect : hurtbox.rect; box.Rect = TransformToFightRect(rect, Position, IsFaceRight); Hurtboxes.Add(box); } PushboxData pushBoxData = fighterData.Actions[CurrentActionID].GetPushboxData(CurrentActionFrame); if (pushBoxData != null) { Pushbox = new Pushbox(); Rect pushRect = pushBoxData.useBaseRect ? fighterData.basePushBoxRect : pushBoxData.rect; Pushbox.Rect = TransformToFightRect(pushRect, Position, IsFaceRight); } }
/// <summary> /// Copy data from current action and convert relative box position with fighter position /// </summary> private void ApplyCurrentActionData() { hitboxes.Clear(); hurtboxes.Clear(); foreach (var hitbox in fighterData.actions[currentActionID].GetHitboxData(currentActionFrame)) { var box = new Hitbox(); box.rect = TransformToFightRect(hitbox.rect, position, isFaceRight); box.proximity = hitbox.proximity; box.attackID = hitbox.attackID; hitboxes.Add(box); } foreach (var hurtbox in fighterData.actions[currentActionID].GetHurtboxData(currentActionFrame)) { var box = new Hurtbox(); Rect rect = hurtbox.useBaseRect ? fighterData.baseHurtBoxRect : hurtbox.rect; box.rect = TransformToFightRect(rect, position, isFaceRight); hurtboxes.Add(box); } var pushBoxData = fighterData.actions[currentActionID].GetPushboxData(currentActionFrame); pushbox = new Pushbox(); Rect pushRect = pushBoxData.useBaseRect ? fighterData.basePushBoxRect : pushBoxData.rect; pushbox.rect = TransformToFightRect(pushRect, position, isFaceRight); }
protected override void Awake() { animator = GetComponent <Animator>(); rb2D = GetComponent <Rigidbody2D>(); tDetection = GetComponentInChildren <TerrainDetection>(); pushbox = GetComponentInChildren <Pushbox>(); }