void PreviewHitBox() { if (GUILayout.Button("Preview Hitbox")) { if (behavior == null && behavior.attackInfos != null) { Debug.LogError("Behavior is Null"); return; } BehaviorAttack atk = behavior.attackInfos[attackInfoIndex]; hitBox.transform.localPosition = atk.hitboxInfo.hitBoxPos; hitBox.transform.localScale = atk.hitboxInfo.hitBoxScale; hitBox.transform.localRotation = atk.hitboxInfo.hitBoxRot; } }
/// <summary> /// A method to apply the transformation of the hitbox /// </summary> /// <param name="h"></param> void SetupHitBox() { if (GUILayout.Button("Apply Hitbox")) { if (behavior == null) { Debug.LogError("Behavior is Null"); return; } BehaviorAttack atk = behavior.attackInfos[attackInfoIndex]; atk.hitboxInfo.hitBoxPos = hitBox.transform.localPosition; atk.hitboxInfo.hitBoxScale = hitBox.transform.localScale; atk.hitboxInfo.hitBoxRot = Quaternion.Euler(hitBox.transform.localEulerAngles); Debug.Log("Successfully set Hitbox for " + behavior.name + "'s AttackInfo Index " + attackInfoIndex); EditorUtility.SetDirty(behavior); AssetDatabase.SaveAssets(); } }