├── .gitignore ├── Assets ├── Documentation.meta ├── Documentation │ ├── Guide.txt │ └── Guide.txt.meta ├── Editor.meta ├── Editor │ ├── BulletPatternEditor.cs │ └── BulletPatternEditor.cs.meta ├── Materials.meta ├── PatternPrefabs.meta ├── PatternPrefabs │ ├── cloudBurst.prefab │ ├── cloudBurst.prefab.meta │ ├── crossSection.prefab │ ├── crossSection.prefab.meta │ ├── homing.prefab │ ├── homing.prefab.meta │ ├── oscillator.prefab │ ├── oscillator.prefab.meta │ ├── overlap.prefab │ ├── overlap.prefab.meta │ ├── progear.prefab │ ├── progear.prefab.meta │ ├── rings.prefab │ ├── rings.prefab.meta │ ├── rockets.prefab │ ├── rockets.prefab.meta │ ├── round.prefab │ ├── round.prefab.meta │ ├── spread.prefab │ └── spread.prefab.meta ├── Prefabs.meta ├── Prefabs │ ├── Bullet1.prefab │ ├── Bullet1.prefab.meta │ ├── Bullet2.prefab │ ├── Bullet2.prefab.meta │ ├── bullet1.mat │ ├── bullet1.mat.meta │ ├── bullet2.mat │ └── bullet2.mat.meta ├── Scenes.meta ├── Scenes │ ├── ExamplePatterns.unity │ └── ExamplePatterns.unity.meta ├── Scripts.meta ├── Scripts │ ├── Bullet.cs │ ├── Bullet.cs.meta │ ├── BulletManager.cs │ ├── BulletManager.cs.meta │ ├── BulletPattern.cs │ ├── BulletPattern.cs.meta │ ├── CamColliders.cs │ ├── CamColliders.cs.meta │ ├── Player.cs │ └── Player.cs.meta ├── Shaders.meta ├── Shaders │ ├── Transparent Vertex Colored.shader │ └── Transparent Vertex Colored.shader.meta ├── Sprites.meta ├── Sprites │ ├── Circle.png │ └── Circle.png.meta ├── Textures.meta └── Textures │ ├── bullet1.png │ ├── bullet1.png.meta │ ├── bullet2.png │ └── bullet2.png.meta ├── ProjectSettings ├── AudioManager.asset ├── ClusterInputManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── NetworkManager.asset ├── Physics2DSettings.asset ├── ProjectSettings.asset ├── ProjectVersion.txt ├── QualitySettings.asset ├── TagManager.asset ├── TimeManager.asset ├── UnityAdsSettings.asset └── UnityConnectSettings.asset └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | /[Ll]ibrary/ 2 | /[Tt]emp/ 3 | /[Oo]bj/ 4 | /[Bb]uild/ 5 | /[Bb]uilds/ 6 | 7 | # Autogenerated VS/MD solution and project files 8 | *.csproj 9 | *.unityproj 10 | *.sln 11 | *.suo 12 | *.tmp 13 | *.user 14 | *.userprefs 15 | *.pidb 16 | *.booproj 17 | 18 | # Unity3D generated meta files 19 | *.pidb.meta 20 | 21 | # Unity3D Generated File On Crash Reports 22 | sysinfo.txt 23 | 24 | # ========================= 25 | # Operating System Files 26 | # ========================= 27 | 28 | # OSX 29 | # ========================= 30 | 31 | .DS_Store 32 | .AppleDouble 33 | .LSOverride 34 | 35 | # Thumbnails 36 | ._* 37 | 38 | # Files that might appear in the root of a volume 39 | .DocumentRevisions-V100 40 | .fseventsd 41 | .Spotlight-V100 42 | .TemporaryItems 43 | .Trashes 44 | .VolumeIcon.icns 45 | 46 | # Directories potentially created on remote AFP share 47 | .AppleDB 48 | .AppleDesktop 49 | Network Trash Folder 50 | Temporary Items 51 | .apdisk 52 | 53 | # Windows 54 | # ========================= 55 | 56 | # Windows image file caches 57 | Thumbs.db 58 | ehthumbs.db 59 | 60 | # Folder config file 61 | Desktop.ini 62 | 63 | # Recycle Bin used on file shares 64 | $RECYCLE.BIN/ 65 | 66 | # Windows Installer files 67 | *.cab 68 | *.msi 69 | *.msm 70 | *.msp 71 | 72 | # Windows shortcuts 73 | *.lnk -------------------------------------------------------------------------------- /Assets/Documentation.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 786badbfa661d704fbeefa5c762b9e3e 3 | folderAsset: yes 4 | timeCreated: 1459072765 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Documentation/Guide.txt: -------------------------------------------------------------------------------- 1 | The BulletPattern object consists of FireTags and BulletTags. When the BulletPattern starts the first index in the 2 | FireTag array will be started. That FireTag will then run through its array of FireTag Actions, creating bullets and 3 | even calling other FireTags. This process creates logic flow similar to programming patterns with code, but through the GUI. 4 | 5 | Bullets that are created will travel forward along the direction that their "creator" (either a FireTag or Bullet) has set for them. 6 | If they have any BulletActions, they will be executed one by one just like with FireTags. 7 | 8 | Keep in mind FireTags are NOT physical entities, but just structs of data to control pattern flow. BulletTags aren't physical either, 9 | but contain the data needed to create a physical Bullet object. A Bullet object is seperate from the BulletPattern or Bullet that created it. 10 | 11 | The BulletManager object is very important. It should always be present in the scene with its BulletManager script attached. 12 | There should only be one. 13 | 14 | 15 | FIRE TAGS 16 | ------------ 17 | 18 | FireTags are completely useless without at least one FireAction. The BulletPattern, once started, will call the first FireTag in the Inspector 19 | and proceed to execute its actions. Below the different actions and what they do will be explained. Change the type of teh action with the 20 | enum pop up box in the GUI. 21 | 22 | WAIT - This will start a "yield WaitForSeconds" command, in which the FireTag will pause and do nothing while the game continues running. 23 | This is useful for breaks in large amounts bullet creation, or pausing between FireTag calls or Loops. Remember that without Wait commands 24 | the entire FireTag will run in frame. In some cases this will freeze the Unity editor, such as in cases with loops with large amounts of 25 | bullet creation. 26 | -------- 27 | 28 | Variables 29 | -------- 30 | 31 | WaitTime - The amount of time to wait, in frames. 20 frames is equal to about 0.333 of a second. Clicking the Randomize box will allow 32 | you to enter two values so a random value will be chosen between the specified range. 33 | 34 | AddRank - Clicking this will add a value to "WaitTime" based on the Global Rank value. Rank is "global" or "game wide" and is a value 35 | between 0 and 1. The AddRank value will be a multiplier to Rank then added to WaitTime. For example, WaitTime could be 20 frames, but 36 | AddRank is 10 frames, meaning up to 10 frames will be added to WaitTime depending on Rank. Though keep in mind usually having a 37 | longer pause in FireTag action would make the game easier, so it would make more sense to have AddRank as -10 frames so that 38 | up to 10 LESS frames would be paused. You can adjust Rank using the slider at the bottom of any BulletPattern object. 39 | 40 | FIRE - Actually creates and fires a bullet object. 41 | ------- 42 | 43 | Variables 44 | -------- 45 | 46 | DirectionType - Controls how we are actually going to point or aim the bullet. Four different types. 47 | TargetPlayer - Aim directly at the player, plus the angle offset 48 | Absolute - Fire at an absolute angle, clockwise. 0 degrees is straightup, 90 is right, 180 is down, 270 is left 49 | Relative - Fire relative to the creator objects rotation. Really only useful if a Bullet is firing a bullet 50 | The Bullet could be traveling at 45 degree angle and fire two bullets at 45 and -45 degree angles in 51 | relation to itself 52 | Sequence - Fire in relation to the last firing angle. For example you could fire at Absolute 0, then Sequence 5 53 | multiple times to make a circle 54 | 55 | Angle - The offset to the directionType as explained above. TargetPlayer with value 10 would shoot 10 degrees off 56 | of the players direction. This value can be randomized and affected by rank as WaitTime above. 57 | 58 | UseParam - If checked, we will use this Tag's paramater value instead of Angle for the offset. More on Param later. 59 | 60 | OverwriteBulletSpeed - If checked, we will use the values set here for the bullets speed, instead of the bulletTag 61 | values. This is useful if several Tags call the same BulletTag but want different speeds. 62 | 63 | NewSpeed - The speed of the bullet. If sequence is checked, then speed will increase sucessively. For example, 5 bullets are 64 | created in a loop with Sequence Speed 8. The bullets speed will be 8,16,24,32,40 repectively. 65 | 66 | PassParam - Pass a random value to be used as a parameter. Params are useful for multiple instances of the same object 67 | to perform differently using their param as a value. 68 | 69 | PassMyParam - Similar to above but this Tags own param that was passes to it will be passed. Passing the torch so to speak. 70 | 71 | BulletTagIndex - The actual index of the BulletTag that has the data needed for the bullet we will create. Make sure you are calling 72 | the right bulletTag and that the array isnt empty. Index 1 = First BulletTag in the array 73 | 74 | 75 | CALL FIRE TAG - Call a FireTag so it can start its process and run its own actions. After the called tag is finished, this tag(the caller) 76 | will resume its process. 77 | ------ 78 | 79 | Variables 80 | --------- 81 | 82 | FireTagIdx - The index of the Firetag to call. Index 1 = First FireTag in index, BE VERY CAREFUL about a FireTag calling itself, as this 83 | will almost always result in infinite recursion. 84 | 85 | PassParam - Pass parameter as described above 86 | 87 | START REPEAT, END REPEAT - Extremely important in dictating logic flow. All actions in between these two actions will be repeated the 88 | specified number of times. Its just like starting a FOR loop in programming terms. Remember that without a WAIT action somewhere in the 89 | loop the entire thing will run in one frame, possibly resulting in freezes. Also possible to nest these for more complex patterns. 90 | 91 | 92 | 93 | 94 | BULLET TAGS 95 | --------------- 96 | 97 | The data for creating an individual Bullet. Unlike FireTags, they dont have to have any actions. The actions in this tag will 98 | be performed by every bullet created with this tag. 99 | 100 | Speed - set the speed of any bullet that uses this Tag 101 | 102 | PrefabIndex - the "type" of this bullet. The BulletManager has an array of BulletPrefabs used in your game. For example, array index 0 103 | can be pink bullets and index 1 can be blue bullets. 104 | 105 | Actions 106 | -------- 107 | 108 | WAIT - Exactly like FireTags wait function. 109 | 110 | CHANGE DIRECTION - Change direction from current angle to new angle, over specified amount of time. The DirectionTypes work similarly 111 | as when creating a bullet - TargetPlayer 20 will move the bullet 20 degrees from the players direction. Relative will chnage the direction 112 | in relation to the currrent one. Sequenmce is the exception, it will continually add to the current rotation every frame for the specified 113 | amount of time. 114 | 115 | Variables 116 | ---------- 117 | Angle - set angle offset with random and rank options 118 | Time - how long it will take to reach teh new rotation, set time to zero for instant change 119 | WaitToFinish - Normally this is an ongoing process, meaning direction can change over time while other actions are being performed. But if this 120 | is checked, all other actions will be halted until the process is finished (meaning the Time has expired). You could get the same effect by 121 | setting a WAIT action directly after this for the same amount of time as this action, but this is easier. 122 | 123 | CHANGE SPEED - Exactly the same as above but with speed instead of direction. 124 | 125 | START REPEAT, END REPEAT - Repeat functions that work the same as FireTag 126 | 127 | FIRE - Again same as FireTag, except much more interesting when a bullet is doing the firing. Be careful when firing a bullet using the same 128 | BulletTag as the creator bullet. This could lead to a large amount of bullets on screen. 129 | 130 | VERTICAL SPEED CHANGE - Speed causes a bullet to go forward in its own forward direction. Using this causes "vertical speed" to go in effect, 131 | which will cause the bullet to go straight up or down regardless of its forward dretion or rotation. Otherwise this performs similarly to 132 | ChangeSpeed action. The bullets regular speed will remain in effect. 133 | 134 | DEACTIVATE - Immediately deactivate and diable this bullet. Useful if a bullet fires some bullets then no longer has any use, thus 135 | deactivates - creating the illusion it "exploded" into multiple bullets. 136 | 137 | 138 | -------------------------------------- 139 | 140 | Under the tags are "WaitBeforeRepeating" And "Rank". The former is the amount in time in frames the Pattern itself waits before repating itself 141 | after the Firetags have done their thing. Rank is a global static variable handled by BulletManager that affects Rank related variables as 142 | described above. 143 | 144 | Thats about it. I hope I Didnt forget anything. If you've encontered any issues, bugs or have questions contact me. Either post in the 145 | Bulletpattern thread in the forums, PM "dhendrix" in the Unity Forums, or email me at "drayhendrix@gmail.com" 146 | 147 | If you feel generous, you can send a small donation with Paypal to "drayhendrix@gmail.com". Thanks. 148 | 149 | 150 | SPECIAL THANKS 151 | 152 | You - of course, no support = no script packages like this one 153 | Unity - for the awesome engine 154 | Kenta Cho - His BulletML system gave me the idea for this package. Plus his pattern breakdowns showed me how some of the more intricate 155 | Bullet Patterns in games work. Seriously, I wish more people had this info out there. His website is "http://www.asahi-net.or.jp/~cs8k-cyu/bulletml/index_e.html" 156 | 157 | THANKS -------------------------------------------------------------------------------- /Assets/Documentation/Guide.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6b97e590bcbf2744da5b9e1063f53c60 3 | TextScriptImporter: 4 | userData: 5 | assetBundleName: 6 | assetBundleVariant: 7 | -------------------------------------------------------------------------------- /Assets/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0346602619dc43c429140bc4127e953f 3 | folderAsset: yes 4 | timeCreated: 1459072738 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Editor/BulletPatternEditor.cs: -------------------------------------------------------------------------------- 1 | // This vicious beast handles the UI for BulletPattern. This is what happens when you design a large and intricate GUI with code 2 | // - do not try this at home. 3 | // 4 | // This file consists of 4 parts, the FireTag stuff, FireAction, BulletTag, and BulletTag 5 | // There is much code repeated throughout the four parts. Unfortunately I dont think creating functions to 6 | // wrap said code would noticeably increase navigation through this jungle. It is however contained in 4 main functions - 7 | // FireTagGUI(); 8 | // FireTagActionsGUI(); 9 | // BulletTagsGUI(); 10 | // BulletTagActionsGUI(); 11 | // 12 | // Enter at your own risk, and if you need to add or edit something to the GUI may mercy be with you 13 | // 14 | 15 | 16 | using UnityEngine; 17 | using UnityEditor; 18 | using System.Collections.Generic; 19 | 20 | [CustomEditor(typeof(BulletPattern))] 21 | [CanEditMultipleObjects] 22 | public class BulletPatternEditor : Editor 23 | { 24 | [SerializeField] 25 | BulletPattern bp; 26 | [SerializeField] 27 | BulletManager bm; 28 | 29 | void OnEnable() 30 | { 31 | bp = target as BulletPattern; 32 | bm = GameObject.Find("BulletManager").GetComponent(); 33 | 34 | } 35 | 36 | public override void OnInspectorGUI() 37 | { 38 | FireTagsGUI(); 39 | BulletTagsGUI(); 40 | 41 | EditorGUILayout.Space(); 42 | EditorGUIUtility.labelWidth = 160; 43 | EditorGUIUtility.fieldWidth = 130; 44 | 45 | bp.waitBeforeRepeating = EditorGUILayout.FloatField("WaitBeforeRepeat", bp.waitBeforeRepeating); 46 | bm.rank = EditorGUILayout.Slider("Rank", bm.rank, 0, 1); 47 | 48 | // temporary fix for losing prefab inspector fields when entering play 49 | if (GUI.changed) 50 | { 51 | EditorUtility.SetDirty(bp); 52 | serializedObject.ApplyModifiedProperties(); 53 | } 54 | } 55 | 56 | void FireTagsGUI() 57 | { 58 | if (bp.fireTags == null) 59 | bp.fireTags = new FireTag[0]; 60 | 61 | List fireTags = new List(bp.fireTags); 62 | 63 | if (fireTags.Count != bp.ftFoldouts.Count) 64 | bp.ftFoldouts = new List(new bool[fireTags.Count]); 65 | 66 | if (fireTags.Count != bp.ftaFoldouts.Count) 67 | { 68 | bp.ftaFoldouts = new List(new ActionFoldouts[fireTags.Count]); 69 | if (bp.ftaFoldouts.Count > 0) 70 | { 71 | for (var zz = 0; zz < bp.ftaFoldouts.Count; zz++) 72 | { 73 | bp.ftaFoldouts[zz] = new ActionFoldouts(); 74 | } 75 | } 76 | } 77 | 78 | GUILayout.BeginHorizontal(); 79 | bp.ftFoldout = EditorGUILayout.Foldout(bp.ftFoldout, "FireTags"); 80 | if (GUILayout.Button("Collapse All", GUILayout.Width(150))) 81 | { 82 | bp.ftFoldout = !bp.ftFoldout; 83 | 84 | for (int zz = 0; zz < bp.ftFoldouts.Count; zz++) 85 | bp.ftFoldouts[zz] = bp.ftFoldout; 86 | } 87 | GUILayout.EndHorizontal(); 88 | 89 | if (bp.ftFoldout) 90 | { 91 | EditorGUI.indentLevel++; 92 | var removeIndex = -1; 93 | var moveIndex = -1; 94 | 95 | for (var l = 0; l < fireTags.Count; l++) 96 | { 97 | EditorGUIUtility.labelWidth = 160; 98 | EditorGUIUtility.fieldWidth = 120; 99 | 100 | GUILayout.BeginHorizontal(); 101 | var str = "FireTag " + (l + 1); 102 | bp.ftFoldouts[l] = EditorGUILayout.Foldout(bp.ftFoldouts[l], str); 103 | 104 | if (GUILayout.Button("Down", GUILayout.Width(50))) 105 | moveIndex = l; 106 | 107 | if (GUILayout.Button("Remove", GUILayout.Width(80))) 108 | removeIndex = l; 109 | GUILayout.EndHorizontal(); 110 | 111 | EditorGUILayout.Space(); 112 | 113 | if (bp.ftFoldouts[l]) 114 | { 115 | GUI.changed = false; 116 | 117 | EditorGUI.indentLevel++; 118 | 119 | if (GUI.changed) 120 | SceneView.RepaintAll(); 121 | 122 | FireTagActionsGUI(l); 123 | 124 | EditorGUI.indentLevel--; 125 | EditorGUILayout.Space(); 126 | } 127 | } 128 | 129 | // if the "down" button was pressed then we move that array index down one time, MAGIC 130 | if (moveIndex >= 0 && moveIndex != fireTags.Count - 1) 131 | { 132 | var temp = fireTags[moveIndex]; 133 | fireTags[moveIndex] = fireTags[moveIndex + 1]; 134 | fireTags[moveIndex + 1] = temp; 135 | 136 | var temp2 = bp.ftFoldouts[moveIndex]; 137 | bp.ftFoldouts[moveIndex] = bp.ftFoldouts[moveIndex + 1]; 138 | bp.ftFoldouts[moveIndex + 1] = temp2; 139 | 140 | var temp3 = bp.ftaFoldouts[moveIndex]; 141 | bp.ftaFoldouts[moveIndex] = bp.ftaFoldouts[moveIndex + 1]; 142 | bp.ftaFoldouts[moveIndex + 1] = temp3; 143 | } 144 | // hmm what could remove do 145 | if (removeIndex >= 0) 146 | { 147 | fireTags.RemoveAt(removeIndex); 148 | bp.ftFoldouts.RemoveAt(removeIndex); 149 | bp.ftaFoldouts.RemoveAt(removeIndex); 150 | } 151 | 152 | //add a space to the GUI, adding a number in those paranthesis(brackets to you brits) will increase the space size 153 | EditorGUILayout.Space(); 154 | 155 | GUILayout.BeginHorizontal(); 156 | GUILayout.Label(""); 157 | if (GUILayout.Button("Add Fire Tag", GUILayout.Width(100))) 158 | { 159 | var ft = new FireTag(); 160 | ft.actions = new FireAction[1]; 161 | 162 | fireTags.Add(ft); 163 | 164 | bp.ftFoldouts.Add(true); 165 | bp.ftaFoldouts.Add(new ActionFoldouts()); 166 | 167 | } 168 | GUILayout.EndHorizontal(); 169 | 170 | bp.fireTags = fireTags.ToArray(); 171 | 172 | EditorGUI.indentLevel--; 173 | 174 | } 175 | 176 | EditorGUILayout.Space(); 177 | } 178 | 179 | //start the FireActions stuff. Its actually even longer and uglier then the previous function 180 | void FireTagActionsGUI(int i) 181 | { 182 | 183 | if (bp.fireTags[i].actions.Length == 0) 184 | { 185 | bp.fireTags[i].actions = new FireAction[1]; 186 | } 187 | 188 | var actions = new List(bp.fireTags[i].actions); 189 | 190 | if (actions.Count != bp.ftaFoldouts[i].sub.Count) 191 | bp.ftaFoldouts[i].sub = new List(new bool[actions.Count]); 192 | 193 | GUILayout.BeginHorizontal(); 194 | bp.ftaFoldouts[i].main = EditorGUILayout.Foldout(bp.ftaFoldouts[i].main, "Actions"); 195 | if (GUILayout.Button("Collapse All", GUILayout.Width(150))) 196 | { 197 | bp.ftaFoldouts[i].main = !bp.ftaFoldouts[i].main; 198 | 199 | for (var zz = 0; zz < bp.ftaFoldouts[i].sub.Count; zz++) 200 | bp.ftaFoldouts[i].sub[zz] = bp.ftaFoldouts[i].main; 201 | } 202 | GUILayout.EndHorizontal(); 203 | 204 | if (bp.ftaFoldouts[i].main) 205 | { 206 | EditorGUI.indentLevel++; 207 | var removeIndex = -1; 208 | var moveIndex = -1; 209 | 210 | for (int l = 0; l < actions.Count; l++) 211 | { 212 | EditorGUIUtility.labelWidth = 160; 213 | EditorGUIUtility.fieldWidth = 125; 214 | 215 | GUILayout.BeginHorizontal(); 216 | var str = "Action " + (l + 1); 217 | bp.ftaFoldouts[i].sub[l] = EditorGUILayout.Foldout(bp.ftaFoldouts[i].sub[l], str); 218 | 219 | if (GUILayout.Button("Down", GUILayout.Width(50))) 220 | moveIndex = l; 221 | if (GUILayout.Button("Remove", GUILayout.Width(80))) 222 | removeIndex = l; 223 | GUILayout.EndHorizontal(); 224 | 225 | if (bp.ftaFoldouts[i].sub[l]) 226 | { 227 | GUI.changed = false; 228 | 229 | EditorGUI.indentLevel++; 230 | 231 | var ac = actions[l]; 232 | 233 | ac.type = (FireActionType)EditorGUILayout.EnumPopup("Action Type", ac.type); 234 | 235 | //an extremely ugly block of GUI code 236 | switch (ac.type) 237 | { 238 | case (FireActionType.Wait): 239 | GUILayout.BeginHorizontal(); 240 | if (!ac.randomWait) 241 | ac.waitTime.x = EditorGUILayout.FloatField("Wait Time", ac.waitTime.x); 242 | else 243 | ac.waitTime = EditorGUILayout.Vector2Field("Time Range", ac.waitTime); 244 | ac.randomWait = EditorGUILayout.Toggle("Randomize", ac.randomWait); 245 | GUILayout.EndHorizontal(); 246 | GUILayout.BeginHorizontal(); 247 | ac.rankWait = EditorGUILayout.Toggle("Add Rank", ac.rankWait); 248 | if (ac.rankWait) 249 | ac.waitTime.z = EditorGUILayout.FloatField("RankWaitTime", ac.waitTime.z); 250 | GUILayout.EndHorizontal(); 251 | break; 252 | 253 | case (FireActionType.Fire): 254 | ac.direction = (DirectionType)EditorGUILayout.EnumPopup("DirectionType", ac.direction); 255 | if (!ac.useParam) 256 | { 257 | GUILayout.BeginHorizontal(); 258 | if (!ac.randomAngle) 259 | ac.angle.x = EditorGUILayout.IntField("Angle", (int)ac.angle.x); 260 | else 261 | ac.angle = EditorGUILayout.Vector2Field("Angle Range", ac.angle); 262 | ac.randomAngle = EditorGUILayout.Toggle("Randomize", ac.randomAngle); 263 | GUILayout.EndHorizontal(); 264 | GUILayout.BeginHorizontal(); 265 | ac.rankAngle = EditorGUILayout.Toggle("Add Rank", ac.rankAngle); 266 | if (ac.rankAngle) 267 | ac.angle.z = EditorGUILayout.FloatField("RankAngle", ac.angle.z); 268 | GUILayout.EndHorizontal(); 269 | } 270 | ac.useParam = EditorGUILayout.Toggle("Use Param", ac.useParam); 271 | EditorGUILayout.Space(); 272 | 273 | ac.overwriteBulletSpeed = EditorGUILayout.Toggle("OverwriteSpd", ac.overwriteBulletSpeed); 274 | if (ac.overwriteBulletSpeed) 275 | { 276 | GUILayout.BeginHorizontal(); 277 | if (!ac.randomSpeed) 278 | ac.speed.x = EditorGUILayout.FloatField("New Speed", ac.speed.x); 279 | else 280 | ac.speed = EditorGUILayout.Vector2Field("Speed Range", ac.speed); 281 | ac.randomSpeed = EditorGUILayout.Toggle("Randomize", ac.randomSpeed); 282 | GUILayout.EndHorizontal(); 283 | GUILayout.BeginHorizontal(); 284 | ac.rankSpeed = EditorGUILayout.Toggle("Add Rank", ac.rankSpeed); 285 | if (ac.rankSpeed) 286 | ac.speed.z = EditorGUILayout.FloatField("RankSpeed", ac.speed.z); 287 | GUILayout.EndHorizontal(); 288 | ac.useSequenceSpeed = EditorGUILayout.Toggle("UseSequence", ac.useSequenceSpeed); 289 | } 290 | 291 | EditorGUILayout.Space(); 292 | GUILayout.BeginHorizontal(); 293 | ac.passParam = EditorGUILayout.Toggle("PassParam", ac.passParam); 294 | if (!ac.passParam) 295 | ac.passPassedParam = EditorGUILayout.Toggle("PassMyParam", ac.passPassedParam); 296 | GUILayout.EndHorizontal(); 297 | if (ac.passParam) 298 | ac.paramRange = EditorGUILayout.Vector2Field("Param Range", ac.paramRange); 299 | ac.bulletTagIndex = EditorGUILayout.IntSlider("BulletTag Index", ac.bulletTagIndex, 1, bp.bulletTags.Length); 300 | break; 301 | 302 | case (FireActionType.CallFireTag): 303 | ac.fireTagIndex = EditorGUILayout.IntSlider("Fire Tag Idx", ac.fireTagIndex, 1, bp.fireTags.Length); 304 | GUILayout.BeginHorizontal(); 305 | ac.passParam = EditorGUILayout.Toggle("PassParam", ac.passParam); 306 | if (!ac.passParam) 307 | ac.passPassedParam = EditorGUILayout.Toggle("PassMyParam", ac.passPassedParam); 308 | GUILayout.EndHorizontal(); 309 | if (ac.passParam) 310 | ac.paramRange = EditorGUILayout.Vector2Field("Param Range", ac.paramRange); 311 | break; 312 | 313 | case (FireActionType.StartRepeat): 314 | ac.repeatCount.x = EditorGUILayout.IntField("RepeatCount", (int)ac.repeatCount.x); 315 | GUILayout.BeginHorizontal(); 316 | ac.rankRepeat = EditorGUILayout.Toggle("AddRank", ac.rankRepeat); 317 | if (ac.rankRepeat) 318 | ac.repeatCount.y = EditorGUILayout.FloatField("RankRepeat", ac.repeatCount.y); 319 | GUILayout.EndHorizontal(); 320 | break; 321 | } 322 | EditorGUI.indentLevel--; 323 | if (GUI.changed) 324 | SceneView.RepaintAll(); 325 | } 326 | } 327 | 328 | if (moveIndex >= 0 && moveIndex != actions.Count - 1) 329 | { 330 | var temp = actions[moveIndex]; 331 | actions[moveIndex] = actions[moveIndex + 1]; 332 | actions[moveIndex + 1] = temp; 333 | 334 | var temp2 = bp.ftaFoldouts[i].sub[moveIndex]; 335 | bp.ftaFoldouts[i].sub[moveIndex] = bp.ftaFoldouts[i].sub[moveIndex + 1]; 336 | bp.ftaFoldouts[i].sub[moveIndex + 1] = temp2; 337 | } 338 | // Ive seen this before somewhere 339 | if (removeIndex >= 0) 340 | { 341 | actions.RemoveAt(removeIndex); 342 | bp.ftaFoldouts[i].sub.RemoveAt(removeIndex); 343 | } 344 | 345 | EditorGUILayout.Space(); 346 | 347 | GUILayout.BeginHorizontal(); 348 | GUILayout.Label(""); 349 | if (GUILayout.Button("Add Action", GUILayout.Width(100))) 350 | { 351 | var ac = new FireAction(); 352 | actions.Add(ac); 353 | bp.ftaFoldouts[i].sub.Add(true); 354 | } 355 | GUILayout.EndHorizontal(); 356 | 357 | bp.fireTags[i].actions = actions.ToArray(); 358 | EditorGUI.indentLevel--; 359 | } 360 | } 361 | 362 | //BulletTag stuff, somewhat shorter than the last one 363 | void BulletTagsGUI() 364 | { 365 | if (bp.bulletTags == null) 366 | bp.bulletTags = new BulletTag[0]; 367 | 368 | var bulletTags = new List(bp.bulletTags); 369 | 370 | if (bulletTags.Count != bp.btFoldouts.Count) 371 | bp.btFoldouts = new List(new bool[bulletTags.Count]); 372 | 373 | if (bulletTags.Count != bp.btaFoldouts.Count) 374 | { 375 | bp.btaFoldouts = new List(new ActionFoldouts[bulletTags.Count]); 376 | if (bp.btaFoldouts.Count > 0) 377 | { 378 | for (var zz = 0; zz < bp.btaFoldouts.Count; zz++) 379 | { 380 | bp.btaFoldouts[zz] = new ActionFoldouts(); 381 | } 382 | } 383 | } 384 | 385 | GUILayout.BeginHorizontal(); 386 | bp.btFoldout = EditorGUILayout.Foldout(bp.btFoldout, "BulletTags"); 387 | if (GUILayout.Button("Collapse All", GUILayout.Width(150))) 388 | { 389 | bp.btFoldout = !bp.btFoldout; 390 | 391 | for (int zz = 0; zz < bp.btFoldouts.Count; zz++) 392 | bp.btFoldouts[zz] = bp.btFoldout; 393 | } 394 | GUILayout.EndHorizontal(); 395 | 396 | if (bp.btFoldout) 397 | { 398 | EditorGUI.indentLevel++; 399 | var removeIndex = -1; 400 | var moveIndex = -1; 401 | 402 | for (var l = 0; l < bulletTags.Count; l++) 403 | { 404 | EditorGUIUtility.labelWidth = 140; 405 | EditorGUIUtility.fieldWidth = 100; 406 | 407 | GUILayout.BeginHorizontal(); 408 | var str = "BulletTag " + (l + 1); 409 | bp.btFoldouts[l] = EditorGUILayout.Foldout(bp.btFoldouts[l], str); 410 | 411 | if (GUILayout.Button("Down", GUILayout.Width(50))) 412 | moveIndex = l; 413 | 414 | if (GUILayout.Button("Remove", GUILayout.Width(80))) 415 | removeIndex = l; 416 | GUILayout.EndHorizontal(); 417 | 418 | EditorGUILayout.Space(); 419 | 420 | if (bp.btFoldouts[l]) 421 | { 422 | GUI.changed = false; 423 | 424 | EditorGUI.indentLevel++; 425 | 426 | var bt = bulletTags[l]; 427 | 428 | GUILayout.BeginHorizontal(); 429 | if (!bt.randomSpeed) 430 | bt.speed.x = EditorGUILayout.FloatField("Speed", bt.speed.x); 431 | else 432 | bt.speed = EditorGUILayout.Vector2Field("Speed Range", bt.speed); 433 | bt.randomSpeed = EditorGUILayout.Toggle("Randomize", bt.randomSpeed); 434 | GUILayout.EndHorizontal(); 435 | GUILayout.BeginHorizontal(); 436 | bt.rankSpeed = EditorGUILayout.Toggle("Add Rank", bt.rankSpeed); 437 | if (bt.rankSpeed) 438 | bt.speed.z = EditorGUILayout.FloatField("RankSpeed", bt.speed.z); 439 | GUILayout.EndHorizontal(); 440 | bt.prefabIndex = EditorGUILayout.IntSlider("PrefabIndex", bt.prefabIndex, 0, bm.bulletPrefab.Length - 1); 441 | 442 | if (GUI.changed) 443 | SceneView.RepaintAll(); 444 | 445 | BulletTagActionsGUI(l); 446 | 447 | EditorGUI.indentLevel--; 448 | EditorGUILayout.Space(); 449 | } 450 | } 451 | 452 | if (moveIndex >= 0 && moveIndex != bulletTags.Count - 1) 453 | { 454 | var temp = bulletTags[moveIndex]; 455 | bulletTags[moveIndex] = bulletTags[moveIndex + 1]; 456 | bulletTags[moveIndex + 1] = temp; 457 | 458 | var temp2 = bp.btFoldouts[moveIndex]; 459 | bp.btFoldouts[moveIndex] = bp.btFoldouts[moveIndex + 1]; 460 | bp.btFoldouts[moveIndex + 1] = temp2; 461 | 462 | var temp3 = bp.btaFoldouts[moveIndex]; 463 | bp.btaFoldouts[moveIndex] = bp.btaFoldouts[moveIndex + 1]; 464 | bp.btaFoldouts[moveIndex + 1] = temp3; 465 | } 466 | 467 | if (removeIndex >= 0) 468 | { 469 | bulletTags.RemoveAt(removeIndex); 470 | bp.btFoldouts.RemoveAt(removeIndex); 471 | bp.btaFoldouts.RemoveAt(removeIndex); 472 | } 473 | 474 | EditorGUILayout.Space(); 475 | 476 | GUILayout.BeginHorizontal(); 477 | GUILayout.Label(""); 478 | if (GUILayout.Button("Add Bullet Tag", GUILayout.Width(100))) 479 | { 480 | var bt = new BulletTag(); 481 | bulletTags.Add(bt); 482 | bp.btFoldouts.Add(true); 483 | bp.btaFoldouts.Add(new ActionFoldouts()); 484 | 485 | } 486 | GUILayout.EndHorizontal(); 487 | 488 | bp.bulletTags = bulletTags.ToArray(); 489 | 490 | } 491 | 492 | EditorGUILayout.Space(); 493 | } 494 | 495 | //obligatory comment that makes this function stand out so you can find it better 496 | void BulletTagActionsGUI(int i) 497 | { 498 | if (bp.bulletTags[i].actions == null) 499 | bp.bulletTags[i].actions = new BulletAction[0]; 500 | 501 | var actions = new List(bp.bulletTags[i].actions); 502 | 503 | if (actions.Count != bp.btaFoldouts[i].sub.Count) 504 | bp.btaFoldouts[i].sub = new List(new bool[actions.Count]); 505 | 506 | GUILayout.BeginHorizontal(); 507 | bp.btaFoldouts[i].main = EditorGUILayout.Foldout(bp.btaFoldouts[i].main, "Actions"); 508 | if (GUILayout.Button("Collapse All", GUILayout.Width(150))) 509 | { 510 | bp.btaFoldouts[i].main = !bp.btaFoldouts[i].main; 511 | 512 | for (var zz = 0; zz < bp.btaFoldouts[i].sub.Count; zz++) 513 | bp.btaFoldouts[i].sub[zz] = bp.btaFoldouts[i].main; 514 | } 515 | GUILayout.EndHorizontal(); 516 | 517 | if (bp.btaFoldouts[i].main) 518 | { 519 | EditorGUI.indentLevel++; 520 | var removeIndex = -1; 521 | var moveIndex = -1; 522 | 523 | for (var l = 0; l < actions.Count; l++) 524 | { 525 | EditorGUIUtility.labelWidth = 140; 526 | EditorGUIUtility.fieldWidth = 100; 527 | 528 | GUILayout.BeginHorizontal(); 529 | var str = "Action " + (l + 1); 530 | bp.btaFoldouts[i].sub[l] = EditorGUILayout.Foldout(bp.btaFoldouts[i].sub[l], str); 531 | 532 | if (GUILayout.Button("Down", GUILayout.Width(50))) 533 | moveIndex = l; 534 | if (GUILayout.Button("Remove", GUILayout.Width(80))) 535 | removeIndex = l; 536 | GUILayout.EndHorizontal(); 537 | 538 | if (bp.btaFoldouts[i].sub[l]) 539 | { 540 | GUI.changed = false; 541 | 542 | EditorGUI.indentLevel++; 543 | 544 | var ac = actions[l]; 545 | 546 | ac.type = (BulletActionType)EditorGUILayout.EnumPopup("Action Type", ac.type); 547 | 548 | switch (ac.type) 549 | { 550 | case (BulletActionType.Wait): 551 | GUILayout.BeginHorizontal(); 552 | if (!ac.randomWait) 553 | ac.waitTime.x = EditorGUILayout.FloatField("Wait Time", ac.waitTime.x); 554 | else 555 | ac.waitTime = EditorGUILayout.Vector2Field("Time Range", ac.waitTime); 556 | ac.randomWait = EditorGUILayout.Toggle("Randomize", ac.randomWait); 557 | GUILayout.EndHorizontal(); 558 | GUILayout.BeginHorizontal(); 559 | ac.rankWait = EditorGUILayout.Toggle("AddRank", ac.rankWait); 560 | if (ac.rankWait) 561 | ac.waitTime.z = EditorGUILayout.FloatField("RankTime", ac.waitTime.z); 562 | GUILayout.EndHorizontal(); 563 | break; 564 | 565 | case (BulletActionType.ChangeDirection): 566 | ac.direction = (DirectionType)EditorGUILayout.EnumPopup("DirectionType", ac.direction); 567 | GUILayout.BeginHorizontal(); 568 | if (!ac.randomAngle) 569 | ac.angle.x = EditorGUILayout.IntField("Angle", (int)ac.angle.x); 570 | else 571 | ac.angle = EditorGUILayout.Vector2Field("Angle Range", ac.angle); 572 | ac.randomAngle = EditorGUILayout.Toggle("Randomize", ac.randomAngle); 573 | GUILayout.EndHorizontal(); 574 | GUILayout.BeginHorizontal(); 575 | ac.rankAngle = EditorGUILayout.Toggle("Add Rank", ac.rankAngle); 576 | if (ac.rankAngle) 577 | ac.angle.z = EditorGUILayout.FloatField("RankAngle", ac.angle.z); 578 | GUILayout.EndHorizontal(); 579 | 580 | GUILayout.BeginHorizontal(); 581 | if (!ac.randomWait) 582 | ac.waitTime.x = EditorGUILayout.FloatField("Time", ac.waitTime.x); 583 | else 584 | ac.waitTime = EditorGUILayout.Vector2Field("Time Range", ac.waitTime); 585 | ac.randomWait = EditorGUILayout.Toggle("Randomize", ac.randomWait); 586 | GUILayout.EndHorizontal(); 587 | GUILayout.BeginHorizontal(); 588 | ac.rankWait = EditorGUILayout.Toggle("AddRank", ac.rankWait); 589 | if (ac.rankWait) 590 | ac.waitTime.z = EditorGUILayout.FloatField("RankTime", ac.waitTime.z); 591 | GUILayout.EndHorizontal(); 592 | 593 | ac.waitForChange = EditorGUILayout.Toggle("WaitToFinish", ac.waitForChange); 594 | break; 595 | 596 | case (BulletActionType.ChangeSpeed): 597 | case (BulletActionType.VerticalChangeSpeed): 598 | GUILayout.BeginHorizontal(); 599 | if (!ac.randomSpeed) 600 | ac.speed.x = EditorGUILayout.FloatField("New Speed", ac.speed.x); 601 | else 602 | ac.speed = EditorGUILayout.Vector2Field("Speed Range", ac.speed); 603 | ac.randomSpeed = EditorGUILayout.Toggle("Randomize", ac.randomSpeed); 604 | GUILayout.EndHorizontal(); 605 | GUILayout.BeginHorizontal(); 606 | ac.rankSpeed = EditorGUILayout.Toggle("Add Rank", ac.rankSpeed); 607 | if (ac.rankSpeed) 608 | ac.speed.z = EditorGUILayout.FloatField("RankSpeed", ac.speed.z); 609 | GUILayout.EndHorizontal(); 610 | EditorGUILayout.Space(); 611 | GUILayout.BeginHorizontal(); 612 | if (!ac.randomWait) 613 | ac.waitTime.x = EditorGUILayout.FloatField("Time", ac.waitTime.x); 614 | else 615 | ac.waitTime = EditorGUILayout.Vector2Field("Time Range", ac.waitTime); 616 | ac.randomWait = EditorGUILayout.Toggle("Randomize", ac.randomWait); 617 | GUILayout.EndHorizontal(); 618 | GUILayout.BeginHorizontal(); 619 | ac.rankWait = EditorGUILayout.Toggle("Add Rank", ac.rankWait); 620 | if (ac.rankWait) 621 | ac.waitTime.z = EditorGUILayout.FloatField("RankTime", ac.waitTime.z); 622 | GUILayout.EndHorizontal(); 623 | 624 | ac.waitForChange = EditorGUILayout.Toggle("WaitToFinish", ac.waitForChange); 625 | break; 626 | 627 | case (BulletActionType.StartRepeat): 628 | ac.repeatCount.x = EditorGUILayout.IntField("Repeat Count", (int)ac.repeatCount.x); 629 | GUILayout.BeginHorizontal(); 630 | ac.rankRepeat = EditorGUILayout.Toggle("AddRank", ac.rankRepeat); 631 | if (ac.rankRepeat) 632 | ac.repeatCount.y = EditorGUILayout.FloatField("RepeatRank", ac.repeatCount.y); 633 | GUILayout.EndHorizontal(); 634 | break; 635 | 636 | case (BulletActionType.Fire): 637 | ac.direction = (DirectionType)EditorGUILayout.EnumPopup("DirectionType", ac.direction); 638 | 639 | if (!ac.useParam) 640 | { 641 | GUILayout.BeginHorizontal(); 642 | if (!ac.randomAngle) 643 | ac.angle.x = EditorGUILayout.IntField("Angle", (int)ac.angle.x); 644 | else 645 | ac.angle = EditorGUILayout.Vector2Field("Angle Range", ac.angle); 646 | ac.randomAngle = EditorGUILayout.Toggle("Randomize", ac.randomAngle); 647 | GUILayout.EndHorizontal(); 648 | GUILayout.BeginHorizontal(); 649 | ac.rankAngle = EditorGUILayout.Toggle("Add Rank", ac.rankAngle); 650 | if (ac.rankAngle) 651 | ac.angle.z = EditorGUILayout.FloatField("RankAngle", ac.angle.z); 652 | GUILayout.EndHorizontal(); 653 | } 654 | ac.useParam = EditorGUILayout.Toggle("UseParamAngle", ac.useParam); 655 | EditorGUILayout.Space(); 656 | ac.overwriteBulletSpeed = EditorGUILayout.Toggle("OverwriteSpeed", ac.overwriteBulletSpeed); 657 | if (ac.overwriteBulletSpeed) 658 | { 659 | GUILayout.BeginHorizontal(); 660 | if (!ac.randomSpeed) 661 | ac.speed.x = EditorGUILayout.FloatField("New Speed", ac.speed.x); 662 | else 663 | ac.speed = EditorGUILayout.Vector2Field("Speed Range", ac.speed); 664 | ac.randomSpeed = EditorGUILayout.Toggle("Randomize", ac.randomSpeed); 665 | GUILayout.EndHorizontal(); 666 | GUILayout.BeginHorizontal(); 667 | ac.rankSpeed = EditorGUILayout.Toggle("Add Rank", ac.rankSpeed); 668 | if (ac.rankSpeed) 669 | ac.speed.z = EditorGUILayout.FloatField("RankSpeed", ac.speed.z); 670 | GUILayout.EndHorizontal(); 671 | ac.useSequenceSpeed = EditorGUILayout.Toggle("UseSequence", ac.useSequenceSpeed); 672 | } 673 | EditorGUILayout.Space(); 674 | ac.bulletTagIndex = EditorGUILayout.IntSlider("BulletTagIdx", ac.bulletTagIndex, 1, bp.bulletTags.Length); 675 | break; 676 | } 677 | EditorGUI.indentLevel--; 678 | if (GUI.changed) 679 | SceneView.RepaintAll(); 680 | } 681 | } 682 | 683 | if (moveIndex >= 0 && moveIndex != actions.Count - 1) 684 | { 685 | var temp = actions[moveIndex]; 686 | actions[moveIndex] = actions[moveIndex + 1]; 687 | actions[moveIndex + 1] = temp; 688 | 689 | var temp2 = bp.btaFoldouts[i].sub[moveIndex]; 690 | bp.btaFoldouts[i].sub[moveIndex] = bp.btaFoldouts[i].sub[moveIndex + 1]; 691 | bp.btaFoldouts[i].sub[moveIndex + 1] = temp2; 692 | } 693 | 694 | if (removeIndex >= 0) 695 | { 696 | actions.RemoveAt(removeIndex); 697 | bp.btaFoldouts[i].sub.RemoveAt(removeIndex); 698 | } 699 | 700 | EditorGUILayout.Space(); 701 | 702 | GUILayout.BeginHorizontal(); 703 | GUILayout.Label(""); 704 | if (GUILayout.Button("Add Action", GUILayout.Width(100))) 705 | { 706 | var ac = new BulletAction(); 707 | actions.Add(ac); 708 | bp.btaFoldouts[i].sub.Add(true); 709 | } 710 | GUILayout.EndHorizontal(); 711 | 712 | bp.bulletTags[i].actions = actions.ToArray(); 713 | } 714 | } 715 | 716 | 717 | } 718 | -------------------------------------------------------------------------------- /Assets/Editor/BulletPatternEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 53d2c4ae73beaac4885e7b00092f9fbe 3 | timeCreated: 1459145944 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cd12a83c7b34e924ab12e3c8b0310bf8 3 | folderAsset: yes 4 | timeCreated: 1459072740 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/PatternPrefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bcf93bba60b0a8e4596bbea96a6d5d31 3 | folderAsset: yes 4 | timeCreated: 1459072738 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/PatternPrefabs/cloudBurst.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/BulletPatternEditorUnity/375401d575fa7544bd6ad211f12f5f0d7dbc3013/Assets/PatternPrefabs/cloudBurst.prefab -------------------------------------------------------------------------------- /Assets/PatternPrefabs/cloudBurst.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 131f653382aef1a42b5e267d66458c42 3 | NativeFormatImporter: 4 | userData: 5 | assetBundleName: 6 | assetBundleVariant: 7 | -------------------------------------------------------------------------------- /Assets/PatternPrefabs/crossSection.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/BulletPatternEditorUnity/375401d575fa7544bd6ad211f12f5f0d7dbc3013/Assets/PatternPrefabs/crossSection.prefab -------------------------------------------------------------------------------- /Assets/PatternPrefabs/crossSection.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 71b08be5c64e446499afeb8298b9f4a9 3 | NativeFormatImporter: 4 | userData: 5 | assetBundleName: 6 | assetBundleVariant: 7 | -------------------------------------------------------------------------------- /Assets/PatternPrefabs/homing.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/BulletPatternEditorUnity/375401d575fa7544bd6ad211f12f5f0d7dbc3013/Assets/PatternPrefabs/homing.prefab -------------------------------------------------------------------------------- /Assets/PatternPrefabs/homing.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bbf4774739f2702469f2c8c053368fdf 3 | NativeFormatImporter: 4 | userData: 5 | assetBundleName: 6 | assetBundleVariant: 7 | -------------------------------------------------------------------------------- /Assets/PatternPrefabs/oscillator.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/BulletPatternEditorUnity/375401d575fa7544bd6ad211f12f5f0d7dbc3013/Assets/PatternPrefabs/oscillator.prefab -------------------------------------------------------------------------------- /Assets/PatternPrefabs/oscillator.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eb230345da64ace438b5157a8dfde434 3 | NativeFormatImporter: 4 | userData: 5 | assetBundleName: 6 | assetBundleVariant: 7 | -------------------------------------------------------------------------------- /Assets/PatternPrefabs/overlap.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/BulletPatternEditorUnity/375401d575fa7544bd6ad211f12f5f0d7dbc3013/Assets/PatternPrefabs/overlap.prefab -------------------------------------------------------------------------------- /Assets/PatternPrefabs/overlap.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f9c31439be6cadd4d82cc2376bd4039a 3 | NativeFormatImporter: 4 | userData: 5 | assetBundleName: 6 | assetBundleVariant: 7 | -------------------------------------------------------------------------------- /Assets/PatternPrefabs/progear.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/BulletPatternEditorUnity/375401d575fa7544bd6ad211f12f5f0d7dbc3013/Assets/PatternPrefabs/progear.prefab -------------------------------------------------------------------------------- /Assets/PatternPrefabs/progear.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 80858de9ac974b2438d449cd4ce247bd 3 | NativeFormatImporter: 4 | userData: 5 | assetBundleName: 6 | assetBundleVariant: 7 | -------------------------------------------------------------------------------- /Assets/PatternPrefabs/rings.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/BulletPatternEditorUnity/375401d575fa7544bd6ad211f12f5f0d7dbc3013/Assets/PatternPrefabs/rings.prefab -------------------------------------------------------------------------------- /Assets/PatternPrefabs/rings.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b63beed5b0a18ba4c9f96aff464196a2 3 | NativeFormatImporter: 4 | userData: 5 | assetBundleName: 6 | assetBundleVariant: 7 | -------------------------------------------------------------------------------- /Assets/PatternPrefabs/rockets.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/BulletPatternEditorUnity/375401d575fa7544bd6ad211f12f5f0d7dbc3013/Assets/PatternPrefabs/rockets.prefab -------------------------------------------------------------------------------- /Assets/PatternPrefabs/rockets.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 22aca924d8ae8114fb347212477926b2 3 | NativeFormatImporter: 4 | userData: 5 | assetBundleName: 6 | assetBundleVariant: 7 | -------------------------------------------------------------------------------- /Assets/PatternPrefabs/round.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/BulletPatternEditorUnity/375401d575fa7544bd6ad211f12f5f0d7dbc3013/Assets/PatternPrefabs/round.prefab -------------------------------------------------------------------------------- /Assets/PatternPrefabs/round.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4b678ce9a6ba0874b87c580ad18ea2e6 3 | NativeFormatImporter: 4 | userData: 5 | assetBundleName: 6 | assetBundleVariant: 7 | -------------------------------------------------------------------------------- /Assets/PatternPrefabs/spread.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/BulletPatternEditorUnity/375401d575fa7544bd6ad211f12f5f0d7dbc3013/Assets/PatternPrefabs/spread.prefab -------------------------------------------------------------------------------- /Assets/PatternPrefabs/spread.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c64bf99641b4f674c93d883852670d7b 3 | NativeFormatImporter: 4 | userData: 5 | assetBundleName: 6 | assetBundleVariant: 7 | -------------------------------------------------------------------------------- /Assets/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5000ac86dc27af84d8da0d7991927b64 3 | folderAsset: yes 4 | timeCreated: 1459072738 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Prefabs/Bullet1.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/BulletPatternEditorUnity/375401d575fa7544bd6ad211f12f5f0d7dbc3013/Assets/Prefabs/Bullet1.prefab -------------------------------------------------------------------------------- /Assets/Prefabs/Bullet1.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 30aa1376eaad7ce4ab4d7fd8a2164bc8 3 | NativeFormatImporter: 4 | userData: 5 | assetBundleName: 6 | assetBundleVariant: 7 | -------------------------------------------------------------------------------- /Assets/Prefabs/Bullet2.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/BulletPatternEditorUnity/375401d575fa7544bd6ad211f12f5f0d7dbc3013/Assets/Prefabs/Bullet2.prefab -------------------------------------------------------------------------------- /Assets/Prefabs/Bullet2.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8c22c3cff0cac384dbce4e9f188885f0 3 | NativeFormatImporter: 4 | userData: 5 | assetBundleName: 6 | assetBundleVariant: 7 | -------------------------------------------------------------------------------- /Assets/Prefabs/bullet1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/BulletPatternEditorUnity/375401d575fa7544bd6ad211f12f5f0d7dbc3013/Assets/Prefabs/bullet1.mat -------------------------------------------------------------------------------- /Assets/Prefabs/bullet1.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 36079c1ae25e3714db57ff2d839e4165 3 | NativeFormatImporter: 4 | userData: 5 | assetBundleName: 6 | assetBundleVariant: 7 | -------------------------------------------------------------------------------- /Assets/Prefabs/bullet2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/BulletPatternEditorUnity/375401d575fa7544bd6ad211f12f5f0d7dbc3013/Assets/Prefabs/bullet2.mat -------------------------------------------------------------------------------- /Assets/Prefabs/bullet2.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a21c448b55f408b438f993667f94087c 3 | NativeFormatImporter: 4 | userData: 5 | assetBundleName: 6 | assetBundleVariant: 7 | -------------------------------------------------------------------------------- /Assets/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: faad342df26afe644b50d5fdf1149ede 3 | folderAsset: yes 4 | timeCreated: 1459072755 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Scenes/ExamplePatterns.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/BulletPatternEditorUnity/375401d575fa7544bd6ad211f12f5f0d7dbc3013/Assets/Scenes/ExamplePatterns.unity -------------------------------------------------------------------------------- /Assets/Scenes/ExamplePatterns.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5b6e4687bf182614c8a9ccc51c2ce4d3 3 | DefaultImporter: 4 | userData: 5 | assetBundleName: 6 | assetBundleVariant: 7 | -------------------------------------------------------------------------------- /Assets/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8251af107c21b0c4992e159ca00ee579 3 | folderAsset: yes 4 | timeCreated: 1459072738 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Scripts/Bullet.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | [System.Serializable] 5 | public class Bullet : MonoBehaviour 6 | { 7 | [HideInInspector] 8 | public GameObject go; 9 | [HideInInspector] 10 | public Transform tform; 11 | [HideInInspector] 12 | public Rigidbody2D rb; 13 | 14 | [SerializeField] 15 | public float speed = 5f; 16 | [SerializeField] 17 | public float verticalSpeed = 0f; 18 | [SerializeField] 19 | public bool useVertical = false; 20 | [SerializeField] 21 | public float lifetime = 0f; 22 | [SerializeField] 23 | public PrevRotWrapper prw = new PrevRotWrapper(); 24 | [SerializeField] 25 | public BulletAction[] actions; 26 | [SerializeField] 27 | public float param = 0f; 28 | [SerializeField] 29 | public int actionIndex = 0; 30 | 31 | [SerializeField] 32 | public BulletPattern master; 33 | 34 | void Awake() 35 | { 36 | go = gameObject; 37 | tform = transform; 38 | rb = GetComponent(); 39 | 40 | //make sure this bullet knows whos his daddy 41 | //actually its so 100 bullet objects dont clutter the hierarchy window 42 | 43 | tform.parent = BulletManager.instance.transform; 44 | } 45 | 46 | 47 | 48 | void FixedUpdate() 49 | { 50 | var targetVelocity = tform.forward * speed; 51 | // dont bother with vertical speed unless its been tampered with (see ChangeSpeedVertical..or was it SpeedChangeVertical?) 52 | if (useVertical) 53 | { 54 | targetVelocity += BulletManager.instance.MainCam.up * verticalSpeed; 55 | } 56 | var velocityChange = (targetVelocity - (Vector3)rb.velocity); 57 | rb.AddForce(velocityChange, ForceMode2D.Force); 58 | 59 | //if you uncomment this stuff the bullet willl die automatically die after awhile 60 | // look at me tempting you like this 61 | 62 | //lifetime += Time.deltaTime; 63 | //if(lifetime > BulletManager.instance.bulletLifespan) 64 | // Deactivate(); 65 | 66 | 67 | } 68 | 69 | 70 | IEnumerator RunActions() 71 | { 72 | for (actionIndex = 0; actionIndex < actions.Length; actionIndex++) 73 | { 74 | switch (actions[actionIndex].type) 75 | { 76 | case (BulletActionType.Wait): 77 | float waitT; 78 | if (actions[actionIndex].randomWait) 79 | waitT = Random.Range(actions[actionIndex].waitTime.x, actions[actionIndex].waitTime.y); 80 | else 81 | waitT = actions[actionIndex].waitTime.x; 82 | if (actions[actionIndex].rankWait) 83 | waitT += BulletManager.instance.rank * actions[actionIndex].waitTime.z; 84 | waitT *= BulletManager.instance.timePerFrame; 85 | yield return new WaitForSeconds(waitT); 86 | break; 87 | case (BulletActionType.ChangeDirection): 88 | if (actions[actionIndex].waitForChange) 89 | yield return StartCoroutine(ChangeDirection(actionIndex)); 90 | else 91 | StartCoroutine(ChangeDirection(actionIndex)); 92 | break; 93 | case (BulletActionType.ChangeSpeed): 94 | if (actions[actionIndex].waitForChange) 95 | yield return StartCoroutine(ChangeSpeed(actionIndex, false)); 96 | else 97 | StartCoroutine(ChangeSpeed(actionIndex, false)); 98 | break; 99 | case (BulletActionType.StartRepeat): 100 | yield return StartCoroutine(RunNestedActions()); 101 | break; 102 | case (BulletActionType.Fire): 103 | if (master != null) 104 | master.Fire(tform, actions[actionIndex], param, prw); 105 | break; 106 | case (BulletActionType.VerticalChangeSpeed): 107 | if (actions[actionIndex].waitForChange) 108 | yield return StartCoroutine(ChangeSpeed(actionIndex, true)); 109 | else 110 | StartCoroutine(ChangeSpeed(actionIndex, true)); 111 | break; 112 | case (BulletActionType.Deactivate): 113 | Deactivate(); 114 | break; 115 | } 116 | } 117 | } 118 | 119 | IEnumerator RunNestedActions() 120 | { 121 | var startIndex = actionIndex; 122 | var endIndex = 0; 123 | actionIndex++; 124 | 125 | float repeatC = actions[startIndex].repeatCount.x; 126 | if (actions[startIndex].rankRepeat) 127 | repeatC += actions[startIndex].repeatCount.y * BulletManager.instance.rank; 128 | repeatC = Mathf.Floor(repeatC); 129 | 130 | for (var y = 0; y < repeatC; y++) 131 | { 132 | while (actions[actionIndex].type != BulletActionType.EndRepeat) 133 | { 134 | switch (actions[actionIndex].type) 135 | { 136 | case (BulletActionType.Wait): 137 | float waitT; 138 | if (actions[actionIndex].randomWait) 139 | waitT = Random.Range(actions[actionIndex].waitTime.x, actions[actionIndex].waitTime.y); 140 | else 141 | waitT = actions[actionIndex].waitTime.x; 142 | if (actions[actionIndex].rankWait) 143 | waitT += BulletManager.instance.rank * actions[actionIndex].waitTime.z; 144 | waitT *= BulletManager.instance.timePerFrame; 145 | yield return new WaitForSeconds(waitT); 146 | break; 147 | case (BulletActionType.ChangeDirection): 148 | if (actions[actionIndex].waitForChange) 149 | yield return ChangeDirection(actionIndex); 150 | else 151 | StartCoroutine(ChangeDirection(actionIndex)); 152 | break; 153 | case (BulletActionType.ChangeSpeed): 154 | if (actions[actionIndex].waitForChange) 155 | yield return ChangeSpeed(actionIndex, false); 156 | else 157 | StartCoroutine(ChangeSpeed(actionIndex, false)); 158 | break; 159 | case (BulletActionType.EndRepeat): 160 | yield return RunNestedActions(); 161 | break; 162 | case (BulletActionType.Fire): 163 | if (master != null) 164 | master.Fire(tform, actions[actionIndex], param, prw); 165 | break; 166 | case (BulletActionType.VerticalChangeSpeed): 167 | if (actions[actionIndex].waitForChange) 168 | yield return ChangeSpeed(actionIndex, true); 169 | else 170 | StartCoroutine(ChangeSpeed(actionIndex, true)); 171 | break; 172 | case (BulletActionType.Deactivate): 173 | Deactivate(); 174 | break; 175 | } 176 | 177 | actionIndex++; 178 | 179 | } 180 | 181 | endIndex = actionIndex; 182 | actionIndex = startIndex + 1; 183 | } 184 | 185 | actionIndex = endIndex; 186 | } 187 | 188 | //activate a bullet, wow what would you do without these comments? 189 | public void Activate() 190 | { 191 | BulletManager.instance.bulletCount++; 192 | lifetime = 0f; 193 | verticalSpeed = 0f; 194 | useVertical = false; 195 | prw.prevRotationNull = true; 196 | StartCoroutine(RunActions()); 197 | } 198 | //we dont actually destroy bullets, were all about recycling 199 | void Deactivate() 200 | { 201 | if (go.activeSelf) 202 | { 203 | BulletManager.instance.bulletCount--; 204 | go.SetActive(false); 205 | } 206 | } 207 | 208 | //im feeling adventurous so im going to try putting comments INSIDE the function, you ready? 209 | IEnumerator ChangeDirection(int i) 210 | { 211 | var t = 0f; 212 | 213 | //determine how long this operation will take 214 | float d; 215 | if (actions[i].randomWait) 216 | d = Random.Range(actions[i].waitTime.x, actions[i].waitTime.y); 217 | else 218 | d = actions[i].waitTime.x; 219 | if (actions[i].rankWait) 220 | d += BulletManager.instance.rank * actions[i].waitTime.z; 221 | 222 | d *= BulletManager.instance.timePerFrame; 223 | 224 | var originalRot = tform.localRotation; 225 | 226 | // determine offset 227 | float ang; 228 | if (actions[i].randomAngle) 229 | ang = Random.Range(actions[i].angle.x, actions[i].angle.y); 230 | else 231 | ang = actions[i].angle.x; 232 | if (actions[i].rankAngle) 233 | ang += BulletManager.instance.rank * actions[i].angle.z; 234 | 235 | Quaternion newRot = Quaternion.identity; 236 | 237 | //and set rotation depending on angle 238 | switch (actions[i].direction) 239 | { 240 | case (DirectionType.TargetPlayer): 241 | var dotHeading = Vector3.Dot(tform.up, BulletManager.instance.player.position - tform.position); 242 | int dir; 243 | if (dotHeading > 0) 244 | dir = -1; 245 | else 246 | dir = 1; 247 | var angleDif = Vector3.Angle(tform.forward, BulletManager.instance.player.position - tform.position); 248 | newRot = originalRot * Quaternion.AngleAxis((dir * angleDif) - ang, Vector3.right); 249 | break; 250 | 251 | case (DirectionType.Absolute): 252 | newRot = Quaternion.Euler(-(ang - 270), 270, 0); 253 | break; 254 | 255 | case (DirectionType.Relative): 256 | newRot = originalRot * Quaternion.AngleAxis(-ang, Vector3.right); 257 | break; 258 | 259 | } 260 | 261 | //Sequence has its own thing going on, continually turning a set amount until time is up 262 | if (actions[i].direction == DirectionType.Sequence) 263 | { 264 | newRot = Quaternion.AngleAxis(-ang, Vector3.right); 265 | 266 | while (t < d) 267 | { 268 | tform.localRotation *= newRot; 269 | t += Time.deltaTime; 270 | yield return new WaitForFixedUpdate(); 271 | } 272 | } 273 | //all the others just linearly progress to destination rotation 274 | else if (d > 0) 275 | { 276 | while (t < d) 277 | { 278 | tform.localRotation = Quaternion.Slerp(originalRot, newRot, t / d); 279 | t += Time.deltaTime; 280 | yield return new WaitForFixedUpdate(); 281 | } 282 | 283 | tform.localRotation = newRot; 284 | } 285 | } 286 | 287 | //its basically the same as the above except without rotations 288 | IEnumerator ChangeSpeed(int i, bool isVertical) 289 | { 290 | 291 | var t = 0f; 292 | var s = 0f; 293 | 294 | if (isVertical) 295 | useVertical = true; 296 | 297 | float d; 298 | if (actions[i].randomWait) 299 | d = Random.Range(actions[i].waitTime.x, actions[i].waitTime.y); 300 | else 301 | d = actions[i].waitTime.x; 302 | if (actions[i].rankWait) 303 | d += BulletManager.instance.rank * actions[i].waitTime.z; 304 | d *= BulletManager.instance.timePerFrame; 305 | 306 | var originalSpeed = speed; 307 | 308 | float newSpeed; 309 | if (actions[i].randomSpeed) 310 | newSpeed = Random.Range(actions[i].speed.x, actions[i].speed.y); 311 | else 312 | newSpeed = actions[i].speed.x; 313 | if (actions[i].rankSpeed) 314 | d += BulletManager.instance.rank * actions[i].speed.z; 315 | 316 | if (d > 0) 317 | { 318 | while (t < d) 319 | { 320 | s = Mathf.Lerp(originalSpeed, newSpeed, t / d); 321 | if (isVertical) verticalSpeed = s; 322 | else speed = s; 323 | t += Time.deltaTime; 324 | 325 | yield return new WaitForFixedUpdate(); 326 | } 327 | } 328 | 329 | if (isVertical) verticalSpeed = newSpeed; 330 | else speed = newSpeed; 331 | } 332 | 333 | //if a bullet leaves the boundary then make sure it actually left the screen, not enetered it 334 | // if it did, then deactivate 335 | // this process MAY be too intensive for iPhone, but then it does keep bullet number under control 336 | void OnTriggerExit2D(Collider2D other) 337 | { 338 | if (other.CompareTag("Boundary")) 339 | { 340 | if (CamColliders.instance.isOutSideBox(tform.position)) 341 | { 342 | Deactivate(); 343 | } 344 | 345 | } 346 | } 347 | 348 | 349 | 350 | } 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | //exclusive bullet action variables 359 | [System.Serializable] 360 | public class BulletAction : BPAction 361 | { 362 | [SerializeField] 363 | public BulletActionType type = BulletActionType.Wait; 364 | [SerializeField] 365 | public bool waitForChange = false; 366 | } 367 | 368 | [System.Serializable] 369 | public enum BulletActionType 370 | { 371 | Wait, 372 | ChangeDirection, 373 | ChangeSpeed, 374 | StartRepeat, 375 | EndRepeat, 376 | Fire, 377 | VerticalChangeSpeed, 378 | Deactivate 379 | }; 380 | 381 | 382 | -------------------------------------------------------------------------------- /Assets/Scripts/Bullet.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 21745b52e307e9144b9c59a415cb8064 3 | timeCreated: 1459074492 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Scripts/BulletManager.cs: -------------------------------------------------------------------------------- 1 | // This script should be attached to ONE gameObject that is always present 2 | // Its necessary for handling orphan bullets who have no BulletPattern father and is required for all order and harmony in 3 | // the Bullet Universe, hence the name - BulletManager 4 | 5 | using UnityEngine; 6 | using System.Collections.Generic; 7 | 8 | public class BulletManager : MonoBehaviour 9 | { 10 | 11 | [SerializeField] 12 | public List bullets = new List(); 13 | 14 | public Bullet[] bulletPrefab; 15 | 16 | public Transform player; 17 | public Transform MainCam; 18 | 19 | public int bulletCount = 0; 20 | public float rank = 0f; 21 | public float bulletLifespan = 5f; 22 | 23 | 24 | //DO NOT change this value unless you want every time-related pattern action to be affected accordingly 25 | //The value is multipled by every user-inputted time variable so that the frame numbers will be converted to smaller 26 | //second based times that the Unity functions (yield.WaitForSWeconds) will accept. 27 | [HideInInspector] 28 | public float timePerFrame = 0.01666f; 29 | //original value = 0.01666; (approximately one 60th of a second) 30 | 31 | public static BulletManager instance; 32 | 33 | 34 | void Awake() 35 | { 36 | instance = this; 37 | 38 | for (var i = 0; i < bulletPrefab.Length; i++) 39 | { 40 | bullets.Add(new BulletList()); 41 | } 42 | } 43 | 44 | 45 | } 46 | 47 | 48 | [System.Serializable] 49 | public class BulletList 50 | { 51 | [SerializeField] 52 | public List bl = new List(); 53 | } -------------------------------------------------------------------------------- /Assets/Scripts/BulletManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0e7f5fa59fc1df143bf61f56cdcf72ed 3 | timeCreated: 1459091635 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Scripts/BulletPattern.cs: -------------------------------------------------------------------------------- 1 | /* Code located in this and related files in this Unity package authored by Daniel Hendricks, copyright 2011 2 | Feel more than welcome to edit and use this code as you see fit, but never claim original authorship. Thanks. 3 | If you have confusion or questions about this code feel free to email me at drayhendrix@gmail.com and I'll do my best 4 | to get back to you. 5 | 6 | These scripts are free to use, but if you feel generous, you can send a small donation with Paypal 7 | to "drayhendrix@gmail.com", Thanks. 8 | 9 | This is the main script of the BulletPattern package. It handles the logic flow of patterns and creation of bullets. 10 | 11 | */ 12 | 13 | using UnityEngine; 14 | using System.Collections.Generic; 15 | using System.Collections; 16 | 17 | [System.Serializable] 18 | public class BulletPattern : MonoBehaviour 19 | { 20 | [SerializeField] 21 | Transform tform; 22 | 23 | [SerializeField] 24 | public FireTag[] fireTags; 25 | [SerializeField] 26 | public BulletTag[] bulletTags; 27 | 28 | [SerializeField] 29 | float sequenceSpeed = 0f; 30 | 31 | [SerializeField] 32 | bool started = false; 33 | [SerializeField] 34 | public float waitBeforeRepeating = 5f; 35 | 36 | 37 | //These belong in the Editor class, as they control whether or not the GUI Foldouts are open or closed 38 | //However by putting them here they will actually SAVE whether or not they are open after deselecting the object 39 | //Bear in mind this does increase mememory usage somewhat (per BulletPattern object) so remove these on release version if necesaary 40 | [SerializeField] 41 | public bool ftFoldout = false; 42 | [SerializeField] 43 | public List ftFoldouts = new List(); 44 | [SerializeField] 45 | public bool btFoldout = false; 46 | [SerializeField] 47 | public List btFoldouts = new List(); 48 | 49 | [SerializeField] 50 | public List ftaFoldouts = new List(); 51 | [SerializeField] 52 | public List btaFoldouts = new List(); 53 | 54 | 55 | [SerializeField] 56 | public enum DirectionType { TargetPlayer, Absolute, Relative, Sequence }; 57 | 58 | //setting these saves a little time on referencing objects later 59 | void Awake() 60 | { 61 | tform = transform; 62 | } 63 | 64 | //get the ball rolling 65 | void Start() 66 | { 67 | StartCoroutine(InitiateFire()); 68 | } 69 | 70 | //resume if the script was disabled then enabled, the bool prevents 2 calls to InstantiateFire on first startup 71 | void OnEnable() 72 | { 73 | if (started) 74 | { 75 | StartCoroutine(InitiateFire()); 76 | } 77 | 78 | } 79 | 80 | //start the first FireTag in the array of tags, then repeat until disabled or destroyed 81 | IEnumerator InitiateFire() 82 | { 83 | if (!started) 84 | yield return new WaitForSeconds(1.0f); 85 | 86 | started = true; 87 | 88 | while (true) 89 | { 90 | yield return StartCoroutine(RunFire(0)); 91 | yield return new WaitForSeconds(waitBeforeRepeating * BulletManager.instance.timePerFrame); 92 | } 93 | } 94 | 95 | 96 | //Gets a bullet and returns it. We look through BulletManager's bullet pool to see if a bullet 97 | // is available, so we can avoid creating abullet if possible. Infinitely creating and 98 | // destroying objects is bad for performance. 99 | Bullet GetInstance(List arr, Transform tform, Bullet prefab) 100 | { 101 | 102 | for (var i = 0; i < arr.Count; i++) 103 | { 104 | var tempGo = (arr[i] as Component).gameObject; 105 | 106 | if (!tempGo.activeSelf) 107 | { 108 | tempGo.SetActive(true); 109 | return arr[i]; 110 | } 111 | } 112 | 113 | var temp = Instantiate(prefab, tform.position, tform.rotation) as Bullet; 114 | arr.Add(temp); 115 | return temp; 116 | } 117 | 118 | //creates a bullet and initiales its parameters 119 | public void Fire(Transform t, BPAction a, float param, PrevRotWrapper prw) 120 | { 121 | //find the correct bulletTag that has info for this bullet 122 | var bt = bulletTags[a.bulletTagIndex - 1]; 123 | 124 | //Debug.Log("bt:"+bt.actions[0].type); 125 | 126 | //get the bullet 127 | Bullet temp = GetInstance(BulletManager.instance.bullets[bt.prefabIndex].bl, t, BulletManager.instance.bulletPrefab[bt.prefabIndex]); 128 | 129 | if (prw.prevRotationNull) 130 | { 131 | prw.prevRotationNull = false; 132 | prw.previousRotation = temp.transform.localRotation; 133 | } 134 | 135 | //set positions equal to its creator, which could be a Firetag or Bullet 136 | temp.transform.position = t.position; 137 | temp.transform.rotation = t.rotation; 138 | //set the abgle offset of new bullet 139 | float ang; 140 | if (a.useParam) 141 | ang = param; 142 | else 143 | { 144 | if (a.randomAngle) 145 | ang = Random.Range(a.angle.x, a.angle.y); 146 | else 147 | ang = a.angle.x; 148 | if (a.rankAngle) 149 | ang += BulletManager.instance.rank * a.angle.z; 150 | } 151 | 152 | //actually point the bullet in the right direction 153 | switch ((DirectionType)a.direction) 154 | { 155 | case (DirectionType.TargetPlayer): 156 | var originalRot = t.rotation; 157 | var dotHeading = Vector3.Dot(temp.transform.up, BulletManager.instance.player.position - temp.transform.position); 158 | 159 | int dir; 160 | if (dotHeading > 0) 161 | dir = -1; 162 | else 163 | dir = 1; 164 | var angleDif = Vector3.Angle(temp.transform.forward, BulletManager.instance.player.position - temp.transform.position); 165 | temp.transform.rotation = originalRot * Quaternion.AngleAxis((dir * angleDif) - ang, Vector3.right); 166 | break; 167 | 168 | case (DirectionType.Absolute): 169 | temp.transform.localRotation = Quaternion.Euler(-(ang - 270), 270, 0); 170 | break; 171 | 172 | case (DirectionType.Relative): 173 | temp.transform.localRotation = t.localRotation * Quaternion.AngleAxis(-ang, Vector3.right); 174 | break; 175 | 176 | case (DirectionType.Sequence): 177 | temp.transform.localRotation = prw.previousRotation * Quaternion.AngleAxis(-ang, Vector3.right); 178 | break; 179 | } 180 | //record this rotation for next Sequence Direction 181 | prw.previousRotation = temp.transform.localRotation; 182 | //set the speed, either from creator's speed data 183 | if (a.overwriteBulletSpeed) 184 | { 185 | float spd; 186 | if (a.randomSpeed) 187 | spd = Random.Range(a.speed.x, a.speed.y); 188 | else 189 | spd = a.speed.x; 190 | if (a.rankSpeed) 191 | spd += BulletManager.instance.rank * a.speed.z; 192 | 193 | if (a.useSequenceSpeed) 194 | { 195 | sequenceSpeed += spd; 196 | temp.speed = sequenceSpeed; 197 | } else 198 | { 199 | sequenceSpeed = 0f; 200 | temp.speed = spd; 201 | } 202 | } 203 | //or bulletTag data 204 | else 205 | { 206 | if (bt.randomSpeed) 207 | temp.speed = Random.Range(bt.speed.x, bt.speed.y); 208 | else 209 | temp.speed = bt.speed.x; 210 | if (bt.rankSpeed) 211 | temp.speed += BulletManager.instance.rank * bt.speed.z; 212 | } 213 | 214 | //set the bullets actions array, so it can perform actions later if it has any 215 | temp.actions = bt.actions; 216 | 217 | //pass random params to bullet, commented out because it seemed to be causing errors and I never used it anyway 218 | 219 | if (a.passParam) 220 | temp.param = Random.Range(a.paramRange.x, a.paramRange.y); 221 | 222 | //pass param that the creator received form another FireTag before creating this bullet(see readMe file) 223 | if (a.passPassedParam) 224 | temp.param = param; 225 | //give the bullet a reference to this script 226 | temp.master = this; 227 | //and activate it 228 | temp.Activate(); 229 | } 230 | 231 | //a wrapper so we can pass an int as reference in the next 2 IEnumerator functions 232 | [System.Serializable] 233 | class IndexWrapper 234 | { 235 | [SerializeField] 236 | public int idx = 0; 237 | } 238 | 239 | //performs logic flow for a FireTag, starting its actions one by one, and even calling other FireTags 240 | IEnumerator RunFire(int i) 241 | { 242 | var ft = fireTags[i]; 243 | var iw = new IndexWrapper(); 244 | 245 | if (ft.actions.Length == 0) 246 | Fire(tform, ft.actions[iw.idx], ft.param, ft.prw); 247 | else 248 | { 249 | for (iw.idx = 0; iw.idx < ft.actions.Length; iw.idx++) 250 | { 251 | switch (ft.actions[iw.idx].type) 252 | { 253 | case (FireActionType.Wait): 254 | float waitT; 255 | if (ft.actions[iw.idx].randomWait) 256 | waitT = Random.Range(ft.actions[iw.idx].waitTime.x, ft.actions[iw.idx].waitTime.y); 257 | else 258 | waitT = ft.actions[iw.idx].waitTime.x; 259 | if (ft.actions[iw.idx].rankWait) 260 | waitT += BulletManager.instance.rank * ft.actions[iw.idx].waitTime.z; 261 | waitT *= BulletManager.instance.timePerFrame; 262 | yield return new WaitForSeconds(waitT); 263 | break; 264 | 265 | case (FireActionType.Fire): 266 | Fire(tform, ft.actions[iw.idx], ft.param, ft.prw); 267 | break; 268 | 269 | case (FireActionType.CallFireTag): 270 | var idx = ft.actions[iw.idx].fireTagIndex - 1; 271 | 272 | if (ft.actions[iw.idx].passParam) 273 | fireTags[idx].param = Random.Range(ft.actions[iw.idx].paramRange.x, ft.actions[iw.idx].paramRange.y); 274 | else if (ft.actions[iw.idx].passPassedParam) 275 | fireTags[idx].param = ft.param; 276 | 277 | if (fireTags[idx].actions.Length > 0) 278 | yield return StartCoroutine(RunFire(idx)); 279 | break; 280 | 281 | case (FireActionType.StartRepeat): 282 | yield return StartCoroutine(RunNestedFire(i, iw)); 283 | break; 284 | } 285 | 286 | } 287 | } 288 | } 289 | //This is basically the same function as above but for nested FireTag actions starting of with a StartRepeat action 290 | // this function ends and resumes to teh above function on a EndRepeat action. There is some duplicated code, 291 | // but I decided to avoid any extra function calls, and completely combining these two functions is too complicated to be worth it 292 | IEnumerator RunNestedFire(int i, IndexWrapper iw) 293 | { 294 | var ft = fireTags[i]; 295 | var startIndex = iw.idx; 296 | var endIndex = 0; 297 | 298 | var repeatC = ft.actions[iw.idx].repeatCount.x; 299 | if (ft.actions[iw.idx].rankRepeat) 300 | repeatC += ft.actions[iw.idx].repeatCount.y * BulletManager.instance.rank; 301 | repeatC = Mathf.Floor(repeatC); 302 | 303 | iw.idx++; 304 | 305 | for (var y = 0; y < repeatC; y++) 306 | { 307 | while (ft.actions[iw.idx].type != FireActionType.EndRepeat) 308 | { 309 | switch (ft.actions[iw.idx].type) 310 | { 311 | case (FireActionType.Wait): 312 | float waitT; 313 | if (ft.actions[iw.idx].randomWait) 314 | waitT = Random.Range(ft.actions[iw.idx].waitTime.x, ft.actions[iw.idx].waitTime.y); 315 | else 316 | waitT = ft.actions[iw.idx].waitTime.x; 317 | if (ft.actions[iw.idx].rankWait) 318 | waitT += BulletManager.instance.rank * ft.actions[iw.idx].waitTime.z; 319 | waitT *= BulletManager.instance.timePerFrame; 320 | yield return new WaitForSeconds(waitT); 321 | break; 322 | 323 | case (FireActionType.Fire): 324 | Fire(tform, ft.actions[iw.idx], ft.param, ft.prw); 325 | break; 326 | 327 | case (FireActionType.CallFireTag): 328 | var idx = ft.actions[iw.idx].fireTagIndex - 1; 329 | 330 | if (ft.actions[iw.idx].passParam) 331 | fireTags[idx].param = Random.Range(ft.actions[iw.idx].paramRange.x, ft.actions[iw.idx].paramRange.y); 332 | else if (ft.actions[iw.idx].passPassedParam) 333 | fireTags[idx].param = ft.param; 334 | 335 | if (fireTags[idx].actions.Length > 0) 336 | yield return StartCoroutine(RunFire(idx)); 337 | break; 338 | 339 | case (FireActionType.StartRepeat): 340 | yield return StartCoroutine(RunNestedFire(i, iw)); 341 | break; 342 | } 343 | 344 | iw.idx++; 345 | 346 | } 347 | 348 | endIndex = iw.idx; 349 | iw.idx = startIndex + 1; 350 | } 351 | 352 | iw.idx = endIndex; 353 | } 354 | 355 | } 356 | 357 | //A FireTag is a procedure of sorts that is exposed to the GUI Inspector in Unity, it controls tha BulletPattern logic flow 358 | [System.Serializable] 359 | public class FireTag 360 | { 361 | [SerializeField] 362 | public float param = 0f; 363 | [SerializeField] 364 | public PrevRotWrapper prw = new PrevRotWrapper(); 365 | [SerializeField] 366 | public FireAction[] actions; 367 | } 368 | // "BulletPatternAction", this is all the action related variables that both FireTag and Bullet actions have in common 369 | [System.Serializable] 370 | public class BPAction 371 | { 372 | [SerializeField] 373 | public Vector3 waitTime; 374 | [SerializeField] 375 | public bool randomWait = false; 376 | [SerializeField] 377 | public bool rankWait = false; 378 | 379 | [SerializeField] 380 | public DirectionType direction; 381 | [SerializeField] 382 | public Vector3 angle; 383 | [SerializeField] 384 | public bool randomAngle = false; 385 | [SerializeField] 386 | public bool rankAngle = false; 387 | 388 | [SerializeField] 389 | public bool overwriteBulletSpeed = false; 390 | [SerializeField] 391 | public Vector3 speed; 392 | [SerializeField] 393 | public bool randomSpeed = false; 394 | [SerializeField] 395 | public bool rankSpeed = false; 396 | [SerializeField] 397 | public bool useSequenceSpeed = false; 398 | 399 | [SerializeField] 400 | public int bulletTagIndex = 0; 401 | [SerializeField] 402 | public bool useParam = false; 403 | 404 | [SerializeField] 405 | public int fireTagIndex = 0; 406 | [SerializeField] 407 | public Vector2 repeatCount; 408 | [SerializeField] 409 | public bool rankRepeat = false; 410 | 411 | [SerializeField] 412 | public bool passParam = false; 413 | [SerializeField] 414 | public bool passPassedParam = false; 415 | [SerializeField] 416 | public Vector2 paramRange; 417 | } 418 | //only thing specific to FireTagActions is the name of actual action type, bullet actions have their own unique types 419 | [System.Serializable] 420 | public class FireAction : BPAction 421 | { 422 | [SerializeField] 423 | public FireActionType type = FireActionType.Wait; 424 | } 425 | 426 | [SerializeField] 427 | public enum FireActionType { Wait, Fire, CallFireTag, StartRepeat, EndRepeat }; 428 | 429 | //Not to be confused with an actual Bullet object. Like a fireTag, it is not physical but contains 430 | //information important for creating and controlling bulets 431 | //[System.Serializable] 432 | [System.Serializable] 433 | public class BulletTag 434 | { 435 | [SerializeField] 436 | public Vector3 speed; 437 | [SerializeField] 438 | public bool randomSpeed = false; 439 | [SerializeField] 440 | public bool rankSpeed = false; 441 | [SerializeField] 442 | public int prefabIndex = 0; 443 | 444 | [SerializeField] 445 | public BulletAction[] actions; 446 | } 447 | //wrapper for passing by reference, so we can track each tag's previous fire rotation 448 | [System.Serializable] 449 | public class PrevRotWrapper 450 | { 451 | [SerializeField] 452 | public Quaternion previousRotation; 453 | [SerializeField] 454 | public bool prevRotationNull = true; 455 | } 456 | 457 | 458 | [System.Serializable] 459 | public class ActionFoldouts 460 | { 461 | [SerializeField] 462 | public bool main = false; 463 | [SerializeField] 464 | public List sub = new List(); 465 | } 466 | 467 | [SerializeField] 468 | public enum DirectionType { TargetPlayer, Absolute, Relative, Sequence }; 469 | 470 | -------------------------------------------------------------------------------- /Assets/Scripts/BulletPattern.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d1c5c714baecd164cb96b7609764de8f 3 | timeCreated: 1459088984 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Scripts/CamColliders.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | public class CamColliders : MonoBehaviour 4 | { 5 | 6 | static Transform tform; 7 | public static CamColliders instance; 8 | 9 | public Transform bottom; 10 | public Transform top; 11 | public Transform right; 12 | public Transform left; 13 | 14 | public LayerMask collideMask; 15 | 16 | void Awake() 17 | { 18 | instance = this; 19 | tform = transform; 20 | } 21 | 22 | public bool isOutSideBox(Vector3 pos) 23 | { 24 | return Physics2D.Linecast(pos, tform.position, collideMask); 25 | } 26 | 27 | Vector3 FindPointInBox(Vector3 pos) 28 | { 29 | var rayDir = (pos - tform.position).normalized; 30 | Ray ray = new Ray(tform.position, rayDir); 31 | RaycastHit hit; 32 | 33 | if (Physics.Raycast(ray, out hit, 100, collideMask)) 34 | { 35 | return hit.point + (-3 * rayDir); 36 | } 37 | 38 | return Vector3.zero; 39 | 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /Assets/Scripts/CamColliders.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 72fe303bef50dcb48a99d5490da8d203 3 | timeCreated: 1459074464 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Scripts/Player.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | public class Player : MonoBehaviour 4 | { 5 | 6 | public GameObject go; 7 | public Transform tform; 8 | public Rigidbody2D rb; 9 | public float speed = 24f; 10 | 11 | int hitCount = 0; 12 | 13 | void Awake() 14 | { 15 | rb = GetComponent(); 16 | go = gameObject; 17 | tform = transform; 18 | } 19 | 20 | void FixedUpdate() 21 | { 22 | var targetVelocity = new Vector3(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"),0); 23 | targetVelocity = transform.TransformDirection(targetVelocity); 24 | targetVelocity *= speed; 25 | 26 | var velocityChange = (targetVelocity - (Vector3)rb.velocity); 27 | 28 | rb.AddForce(velocityChange, ForceMode2D.Force); 29 | } 30 | 31 | void OnTriggerEnter2D(Collider2D other) 32 | { 33 | if (other.CompareTag("Bullet")) 34 | { 35 | hitCount++; 36 | Debug.Log("Hit " + hitCount + " times!"); 37 | } 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /Assets/Scripts/Player.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d3b46bc93bc8a7c4f9271099f8e0cd76 3 | timeCreated: 1459073385 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Shaders.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cc00584a37bc2324cb79844367e841b0 3 | folderAsset: yes 4 | timeCreated: 1459072738 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Shaders/Transparent Vertex Colored.shader: -------------------------------------------------------------------------------- 1 | Shader "Transparent/Vertex Colored" { 2 | Properties { 3 | _Color ("Main Color", Color) = (0.5,0.5,0.5,1) 4 | _Emission ("Emmisive Color", Color) = (0,0,0,0) 5 | _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {} 6 | } 7 | 8 | Category { 9 | Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"} 10 | ZWrite Off 11 | Alphatest Greater 0 12 | Blend SrcAlpha OneMinusSrcAlpha 13 | SubShader { 14 | Material { 15 | Diffuse [_Color] 16 | Ambient [_Color] 17 | Emission [_Emission] 18 | } 19 | Pass { 20 | ColorMaterial AmbientAndDiffuse 21 | Lighting Off 22 | Cull Off 23 | SetTexture [_MainTex] { 24 | Combine texture * primary, texture * primary 25 | } 26 | SetTexture [_MainTex] { 27 | constantColor [_Color] 28 | Combine previous * constant DOUBLE, previous * constant 29 | } 30 | } 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /Assets/Shaders/Transparent Vertex Colored.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 339f47667f1f8e64f92f52392f834d96 3 | ShaderImporter: 4 | defaultTextures: [] 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Sprites.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cc9bccdf3ad210d40b526ac87fd46cc1 3 | folderAsset: yes 4 | timeCreated: 1459072812 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Sprites/Circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/BulletPatternEditorUnity/375401d575fa7544bd6ad211f12f5f0d7dbc3013/Assets/Sprites/Circle.png -------------------------------------------------------------------------------- /Assets/Sprites/Circle.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4febb24116185c64dbd1f6a1e5346ff6 3 | timeCreated: 1459348381 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 2 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 0 11 | linearTexture: 0 12 | correctGamma: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 0 25 | cubemapConvolution: 0 26 | cubemapConvolutionSteps: 7 27 | cubemapConvolutionExponent: 1.5 28 | seamlessCubemap: 0 29 | textureFormat: -3 30 | maxTextureSize: 2048 31 | textureSettings: 32 | filterMode: 0 33 | aniso: 16 34 | mipBias: 0 35 | wrapMode: 1 36 | nPOTScale: 0 37 | lightmap: 0 38 | rGBM: 0 39 | compressionQuality: 50 40 | allowsAlphaSplitting: 0 41 | spriteMode: 3 42 | spriteExtrude: 1 43 | spriteMeshType: 1 44 | alignment: 0 45 | spritePivot: {x: 0.5, y: 0.5} 46 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 47 | spritePixelsToUnits: 4 48 | alphaIsTransparency: 1 49 | textureType: 8 50 | buildTargetSettings: [] 51 | spriteSheet: 52 | sprites: [] 53 | outline: 54 | - - {x: 2, y: 4} 55 | - {x: 2.0981355, y: 3.997591} 56 | - {x: 2.1960342, y: 3.9903693} 57 | - {x: 2.2934608, y: 3.978353} 58 | - {x: 2.3901806, y: 3.9615705} 59 | - {x: 2.4859605, y: 3.9400625} 60 | - {x: 2.5805693, y: 3.9138808} 61 | - {x: 2.6737797, y: 3.883088} 62 | - {x: 2.7653668, y: 3.8477592} 63 | - {x: 2.8551102, y: 3.8079786} 64 | - {x: 2.9427934, y: 3.7638426} 65 | - {x: 3.0282054, y: 3.7154572} 66 | - {x: 3.1111405, y: 3.662939} 67 | - {x: 3.1913986, y: 3.606415} 68 | - {x: 3.2687867, y: 3.546021} 69 | - {x: 3.343118, y: 3.4819021} 70 | - {x: 3.4142137, y: 3.4142134} 71 | - {x: 3.4819024, y: 3.3431177} 72 | - {x: 3.546021, y: 3.2687864} 73 | - {x: 3.6064153, y: 3.1913984} 74 | - {x: 3.6629395, y: 3.1111403} 75 | - {x: 3.7154574, y: 3.0282052} 76 | - {x: 3.7638426, y: 2.9427931} 77 | - {x: 3.8079786, y: 2.8551097} 78 | - {x: 3.8477592, y: 2.7653666} 79 | - {x: 3.8830884, y: 2.6737792} 80 | - {x: 3.9138808, y: 2.5805688} 81 | - {x: 3.9400625, y: 2.4859598} 82 | - {x: 3.9615707, y: 2.39018} 83 | - {x: 3.978353, y: 2.2934604} 84 | - {x: 3.9903696, y: 2.1960335} 85 | - {x: 3.997591, y: 2.0981345} 86 | - {x: 4, y: 1.9999992} 87 | - {x: 3.997591, y: 1.9018638} 88 | - {x: 3.9903693, y: 1.8039649} 89 | - {x: 3.978353, y: 1.7065382} 90 | - {x: 3.9615703, y: 1.6098185} 91 | - {x: 3.9400623, y: 1.5140387} 92 | - {x: 3.9138803, y: 1.4194297} 93 | - {x: 3.8830876, y: 1.3262193} 94 | - {x: 3.8477588, y: 1.234632} 95 | - {x: 3.8079782, y: 1.144889} 96 | - {x: 3.763842, y: 1.0572059} 97 | - {x: 3.715457, y: 0.971794} 98 | - {x: 3.662939, y: 0.8888593} 99 | - {x: 3.606415, y: 0.80860126} 100 | - {x: 3.546021, y: 0.73121345} 101 | - {x: 3.4819026, y: 0.6568823} 102 | - {x: 3.414214, y: 0.5857868} 103 | - {x: 3.3431184, y: 0.51809824} 104 | - {x: 3.2687874, y: 0.4539796} 105 | - {x: 3.1913996, y: 0.39358556} 106 | - {x: 3.1111417, y: 0.33706152} 107 | - {x: 3.0282068, y: 0.2845435} 108 | - {x: 2.9427948, y: 0.23615825} 109 | - {x: 2.8551118, y: 0.1920222} 110 | - {x: 2.7653687, y: 0.1522417} 111 | - {x: 2.6737819, y: 0.1169126} 112 | - {x: 2.5805717, y: 0.08612001} 113 | - {x: 2.4859629, y: 0.059938192} 114 | - {x: 2.3901834, y: 0.038429976} 115 | - {x: 2.293464, y: 0.021647453} 116 | - {x: 2.1960375, y: 0.0096309185} 117 | - {x: 2.0981388, y: 0.0024092197} 118 | - {x: 2.0000036, y: 0} 119 | - {x: 1.9018685, y: 0.002408862} 120 | - {x: 1.8039697, y: 0.009630203} 121 | - {x: 1.7065432, y: 0.02164638} 122 | - {x: 1.6098237, y: 0.038428545} 123 | - {x: 1.5140442, y: 0.059936404} 124 | - {x: 1.4194353, y: 0.08611798} 125 | - {x: 1.326225, y: 0.11691022} 126 | - {x: 1.234638, y: 0.15223897} 127 | - {x: 1.1448947, y: 0.1920191} 128 | - {x: 1.0572114, y: 0.2361548} 129 | - {x: 0.9717995, y: 0.28453982} 130 | - {x: 0.8888645, y: 0.33705747} 131 | - {x: 0.8086064, y: 0.39358127} 132 | - {x: 0.73121834, y: 0.45397508} 133 | - {x: 0.65688694, y: 0.51809335} 134 | - {x: 0.58579123, y: 0.5857816} 135 | - {x: 0.5181024, y: 0.6568769} 136 | - {x: 0.4539833, y: 0.7312082} 137 | - {x: 0.39358878, y: 0.80859625} 138 | - {x: 0.33706427, y: 0.8888544} 139 | - {x: 0.28454578, y: 0.9717895} 140 | - {x: 0.23616016, y: 1.0572016} 141 | - {x: 0.19202375, y: 1.1448851} 142 | - {x: 0.1522429, y: 1.2346284} 143 | - {x: 0.11691344, y: 1.3262157} 144 | - {x: 0.086120605, y: 1.4194263} 145 | - {x: 0.05993855, y: 1.5140355} 146 | - {x: 0.038430214, y: 1.6098155} 147 | - {x: 0.021647573, y: 1.7065355} 148 | - {x: 0.0096309185, y: 1.8039623} 149 | - {x: 0.0024092197, y: 1.9018615} 150 | - {x: 0, y: 1.9999971} 151 | - {x: 0.0024089813, y: 2.0981328} 152 | - {x: 0.009630322, y: 2.196032} 153 | - {x: 0.021646738, y: 2.293459} 154 | - {x: 0.03842914, y: 2.390179} 155 | - {x: 0.05993712, y: 2.485959} 156 | - {x: 0.08611894, y: 2.5805683} 157 | - {x: 0.11691153, y: 2.673779} 158 | - {x: 0.15224075, y: 2.7653663} 159 | - {x: 0.19202125, y: 2.85511} 160 | - {x: 0.23615742, y: 2.9427934} 161 | - {x: 0.28454292, y: 3.0282056} 162 | - {x: 0.33706105, y: 3.1111407} 163 | - {x: 0.39358544, y: 3.191399} 164 | - {x: 0.45397973, y: 3.2687874} 165 | - {x: 0.5180986, y: 3.343119} 166 | - {x: 0.58578753, y: 3.4142146} 167 | - {x: 0.6568835, y: 3.4819036} 168 | - {x: 0.7312151, y: 3.5460224} 169 | - {x: 0.8086034, y: 3.6064167} 170 | - {x: 0.8888618, y: 3.6629407} 171 | - {x: 0.9717971, y: 3.7154589} 172 | - {x: 1.0572095, y: 3.763844} 173 | - {x: 1.144893, y: 3.80798} 174 | - {x: 1.2346367, y: 3.8477607} 175 | - {x: 1.3262241, y: 3.8830895} 176 | - {x: 1.4194348, y: 3.9138818} 177 | - {x: 1.5140442, y: 3.9400635} 178 | - {x: 1.6098242, y: 3.9615717} 179 | - {x: 1.7065442, y: 3.9783537} 180 | - {x: 1.8039712, y: 3.99037} 181 | - {x: 1.9018705, y: 3.997591} 182 | spritePackingTag: 183 | userData: 184 | assetBundleName: 185 | assetBundleVariant: 186 | -------------------------------------------------------------------------------- /Assets/Textures.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b28739963a03d774aa4a83a43082365c 3 | folderAsset: yes 4 | timeCreated: 1459072811 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Textures/bullet1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/BulletPatternEditorUnity/375401d575fa7544bd6ad211f12f5f0d7dbc3013/Assets/Textures/bullet1.png -------------------------------------------------------------------------------- /Assets/Textures/bullet1.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e9cc41d008f2c3f42970247d73a1c568 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | serializedVersion: 2 6 | mipmaps: 7 | mipMapMode: 0 8 | enableMipMap: 1 9 | linearTexture: 0 10 | correctGamma: 0 11 | fadeOut: 0 12 | borderMipMap: 0 13 | mipMapFadeDistanceStart: 1 14 | mipMapFadeDistanceEnd: 3 15 | bumpmap: 16 | convertToNormalMap: 0 17 | externalNormalMap: 0 18 | heightScale: 0.25 19 | normalMapFilter: 0 20 | isReadable: 0 21 | grayScaleToAlpha: 0 22 | generateCubemap: 0 23 | cubemapConvolution: 0 24 | cubemapConvolutionSteps: 7 25 | cubemapConvolutionExponent: 1.5 26 | seamlessCubemap: 0 27 | textureFormat: -1 28 | maxTextureSize: 1024 29 | textureSettings: 30 | filterMode: 1 31 | aniso: 1 32 | mipBias: -1 33 | wrapMode: 1 34 | nPOTScale: 1 35 | lightmap: 0 36 | rGBM: 0 37 | compressionQuality: 50 38 | allowsAlphaSplitting: 0 39 | spriteMode: 0 40 | spriteExtrude: 1 41 | spriteMeshType: 1 42 | alignment: 0 43 | spritePivot: {x: 0.5, y: 0.5} 44 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 45 | spritePixelsToUnits: 100 46 | alphaIsTransparency: 0 47 | textureType: -1 48 | buildTargetSettings: [] 49 | spriteSheet: 50 | sprites: [] 51 | outline: [] 52 | spritePackingTag: 53 | userData: 54 | assetBundleName: 55 | assetBundleVariant: 56 | -------------------------------------------------------------------------------- /Assets/Textures/bullet2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/BulletPatternEditorUnity/375401d575fa7544bd6ad211f12f5f0d7dbc3013/Assets/Textures/bullet2.png -------------------------------------------------------------------------------- /Assets/Textures/bullet2.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ad150935345f1584eb99c8304dae4adf 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | serializedVersion: 2 6 | mipmaps: 7 | mipMapMode: 0 8 | enableMipMap: 1 9 | linearTexture: 0 10 | correctGamma: 0 11 | fadeOut: 0 12 | borderMipMap: 0 13 | mipMapFadeDistanceStart: 1 14 | mipMapFadeDistanceEnd: 3 15 | bumpmap: 16 | convertToNormalMap: 0 17 | externalNormalMap: 0 18 | heightScale: 0.25 19 | normalMapFilter: 0 20 | isReadable: 0 21 | grayScaleToAlpha: 0 22 | generateCubemap: 0 23 | cubemapConvolution: 0 24 | cubemapConvolutionSteps: 7 25 | cubemapConvolutionExponent: 1.5 26 | seamlessCubemap: 0 27 | textureFormat: -1 28 | maxTextureSize: 1024 29 | textureSettings: 30 | filterMode: 1 31 | aniso: 1 32 | mipBias: -1 33 | wrapMode: 1 34 | nPOTScale: 1 35 | lightmap: 0 36 | rGBM: 0 37 | compressionQuality: 50 38 | allowsAlphaSplitting: 0 39 | spriteMode: 0 40 | spriteExtrude: 1 41 | spriteMeshType: 1 42 | alignment: 0 43 | spritePivot: {x: 0.5, y: 0.5} 44 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 45 | spritePixelsToUnits: 100 46 | alphaIsTransparency: 0 47 | textureType: -1 48 | buildTargetSettings: [] 49 | spriteSheet: 50 | sprites: [] 51 | outline: [] 52 | spritePackingTag: 53 | userData: 54 | assetBundleName: 55 | assetBundleVariant: 56 | -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/BulletPatternEditorUnity/375401d575fa7544bd6ad211f12f5f0d7dbc3013/ProjectSettings/AudioManager.asset -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/BulletPatternEditorUnity/375401d575fa7544bd6ad211f12f5f0d7dbc3013/ProjectSettings/ClusterInputManager.asset -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/BulletPatternEditorUnity/375401d575fa7544bd6ad211f12f5f0d7dbc3013/ProjectSettings/DynamicsManager.asset -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/BulletPatternEditorUnity/375401d575fa7544bd6ad211f12f5f0d7dbc3013/ProjectSettings/EditorBuildSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/BulletPatternEditorUnity/375401d575fa7544bd6ad211f12f5f0d7dbc3013/ProjectSettings/EditorSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/BulletPatternEditorUnity/375401d575fa7544bd6ad211f12f5f0d7dbc3013/ProjectSettings/GraphicsSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/BulletPatternEditorUnity/375401d575fa7544bd6ad211f12f5f0d7dbc3013/ProjectSettings/InputManager.asset -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/BulletPatternEditorUnity/375401d575fa7544bd6ad211f12f5f0d7dbc3013/ProjectSettings/NavMeshAreas.asset -------------------------------------------------------------------------------- /ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/BulletPatternEditorUnity/375401d575fa7544bd6ad211f12f5f0d7dbc3013/ProjectSettings/NetworkManager.asset -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/BulletPatternEditorUnity/375401d575fa7544bd6ad211f12f5f0d7dbc3013/ProjectSettings/Physics2DSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/BulletPatternEditorUnity/375401d575fa7544bd6ad211f12f5f0d7dbc3013/ProjectSettings/ProjectSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 5.3.4f1 2 | m_StandardAssetsVersion: 0 3 | -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/BulletPatternEditorUnity/375401d575fa7544bd6ad211f12f5f0d7dbc3013/ProjectSettings/QualitySettings.asset -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/BulletPatternEditorUnity/375401d575fa7544bd6ad211f12f5f0d7dbc3013/ProjectSettings/TagManager.asset -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/BulletPatternEditorUnity/375401d575fa7544bd6ad211f12f5f0d7dbc3013/ProjectSettings/TimeManager.asset -------------------------------------------------------------------------------- /ProjectSettings/UnityAdsSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/BulletPatternEditorUnity/375401d575fa7544bd6ad211f12f5f0d7dbc3013/ProjectSettings/UnityAdsSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unitycoder/BulletPatternEditorUnity/375401d575fa7544bd6ad211f12f5f0d7dbc3013/ProjectSettings/UnityConnectSettings.asset -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # BulletPatternEditorUnity 2 | 3 | BulletPatternEditor - easily create shoot em up bullet patterns 4 | 5 | This will be updated C# version of the original free package : 6 | http://forum.unity3d.com/threads/bulletpatterneditor-easily-create-shoot-em-up-bullet-patterns-free.118930/ 7 | 8 | Using Unity 5.3.4f1 9 | 10 | (WORK-IN-PROGRESS) 11 | 12 | # Original readme 13 | 14 | Code located in this and related files in this Unity package authored by Daniel Hendricks, copyright 2011 15 | Feel more than welcome to edit and use this code as you see fit, but never claim original authorship. Thanks. 16 | If you have confusion or questions about this code feel free to email me at drayhendrix( at )gmail.com and I'll do my best 17 | to get back to you. 18 | 19 | These scripts are free to use, but if you feel generous, you can send a small donation with Paypal 20 | to "drayhendrix( at )gmail.com", Thanks. 21 | 22 | # Website 23 | 24 | http://unitycoder.com/blog/2016/03/27/shmup-bullet-pattern-editor/ 25 | --------------------------------------------------------------------------------