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.
Building
is apartial
class 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.GameOverScreen
uses Lazy Asset Injection to get a reference to its prefab. Instead of having aGameOverScreen
field 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.MissileLauncher
allows the player to aim with the mouse cursor and click to fireMissile
s.Score
uses a UIText
component 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