Quick Start
You can either evolve your own weapons in WeaponEvolutionScene or choose from 70 pre-configured weapons.
Table of contents
- Using pre-made weapons
- Evolving new weapons
- Creating ScriptableObjects for new weapons
- Using combined weapons
Using pre-made weapons
If you want to use one of the 70 pre-made weapons, follow these steps:
-
Place the EvolutionAlgorithm.prefab and EvoSceneWeapon.prefab into your scene.
-
Choose an instance of Weapon Params SO and drag it into the Weapon SO property of the EvoSceneWeapon in your scene. All instances of Weapon Params SO follow this name convention
WP_<UniqueHash>
. Use search to find them. -
Select the gameobject that will be the parent for the instantiated projectiles. Drag it into the Projectiles Parent Transform property of the EvoSceneWeapon in your scene.
-
Press the play button.
Evolving new weapons
If you want to evolve your own weapons, follow these steps:
-
Open WeaponEvolutionScene and press the play button.
-
Find ScriptableObject EvoWeaponParams and use its inspector to adjust weapon parameters.
-
Select good weapons using Select as parent for next get button in the EvoWeapon inspector. Press New Generation button.
-
If you found the weapon you like, you can save it by clicking on Save button in the EvoWeapon inspector. The two files that represent the weapon will be created
Genome_<UniqueHash>.xml
andParams_<UniqueHash>.json
. These files will be saved to the directoryResources\ProjectileGenomes\<UniqueHash>
.
EvoWeapon custom editor supports editing of multiple objects. If you select multiple EvoWeapons, Select as parent for next get and Save buttons would work correctly.
Creating ScriptableObjects for new weapons
Lets suppose you evolved and saved a lot of weapons, now you have a bunch of folders with Genome_<UniqueHash>.xml
and Params_<UniqueHash>.json
files inside. How to use them?
- You need to create WeaponParamsSO in every folder:
- Create WeaponParamsSO:
- RightClick on the folder in project view
- Create –> ScriptableObjects –> WeaponParamsSO
- Copy and Paste the created WeaponParamsSO into every folder
- Create WeaponParamsSO:
-
Search for “WP” within the
Resources\ProjectileGenomes
folder -
Select all of them and press Load files from folder button in the inspector (press it twice if
Rename
option is checked). Then press Load button. - Now you can use these new weapons. See Using pre-made weapons.
Using combined weapons
Combined weapon is a weapon with moving or rotating coordinate systems. 10 combined weapons are available. Follow these steps to use them:
-
Place the EvolutionAlgorithm.prefab and EvoSceneWeapon.prefab into your scene.
- Choose a combined weapon from the CombinedWeapon script. Let’s choose #8. Copy and paste the contents of the Fire8 method into EvoWeapon script and override the Fire method of EvoWeapon. (Or you can just copy and paste the code below into the EvoWeapon script)
public override IEnumerator Fire() { _shotsCount = 0; while (true) { yield return Fire8(); } } // based on WP#43 private int _shotsCount; public IEnumerator Fire8() { _weaponParamsLocal.SpeedRange = new Vector2(2f, 5f); _weaponParamsLocal.NNControlDistance = 1.2f; _weaponParamsLocal.ProjectilesInOneShot = 12; base.FireMultiShot(); yield return new WaitForSeconds(0.5f); var system = CoordinateSystems.Last(); system.IsRotating = true; system.RotatingSpeed = 120f; system.RotationAcc = _shotsCount % 2 == 0 ? 80f : -80f; system.IsMoving = true; system.MoveSpeed = 6f; system.MoveAcc = 10f; system.Direction = ProjectileSpawnPoint.up; _shotsCount += 1; }
-
Find the WP_7621C6D0 and drag it into the Weapon SO property of the EvoSceneWeapon in your scene.
-
Select the gameobject that will be the parent for the instantiated projectiles. Drag it into the Projectiles Parent Transform property of the EvoSceneWeapon in your scene.
- Press the play button.