This example scene is located in Assets/Plugins/Weaver/Examples/05 Missile Command. It brings all the previous examples together in a simple game which also uses Pref Injection and Lazy Asset Injection.
Buildingis apartialclass which is split into multiple files. The file in this example contains the code to destroy the buildings when they are hit at runtime while the procedural asset generation code for the Building example is located over in that folder because it isn't relevant to this example.GameOverScreenuses Lazy Asset Injection to get a reference to its prefab. Instead of having aGameOverScreenfield to get a direct reference, it has aWeaver.Asset<GameOverScreen>so Weaver will inject the prefab's resource path, meaning that at runtime the prefab doesn't get loaded into memory until it is actually used.MissileLauncherallows the player to aim with the mouse cursor and click to fireMissiles.Scoreuses a UITextcomponent to display the current value and an injectedObjectPool<FloatingText>to indicate when the value is changed.- It also uses
[Pref]Injection to automatically save the high score value inPlayerPrefs.
- It also uses