The DanmakuController

The DanmakuController is the global interface to the Danmaku Engine and it defines essential parameters.

Every scene which uses the Danmaku Engine requires exactly one GameObject with the DanmakuController-component attached to it.

To add the DanmakuController-component to a GameObject, select it first and then choose "Component -> Danmaku Engine -> DanmakuController" from the menu.

You can also add the component from the inspector of the currently selected GameObject by clicking "Add Component -> Danmaku Engine -> DanmakuController".

The name and location of this GameObject are not important - just choose a meaningful name and an appropriate location.

To make sure that the DanmakuController-component is initialized properly before you access it with your own code, you should set its execution-order accordingly.

  • Use Frame Based Time
    Determines if all time-dependent calculations are based on seconds or frames.
    Read more about how the Danmaku Engine handles time here.

  • Do Not Destroy On Load
    Determines if this GameObject will be destroyed when another scene is loaded or not.

  • Contexts
    A set of contexts which define essential parameters.

Setting up contexts

All bullets and emitters operate on a specific context which determines their behaviour. To make the Danmaku Engine work, you have to define at least one context but you can define as many as you want. This is useful if you want to specify certain parameters for regular enemies, bosses and players independently, for example.

  • Name
    The name of this context which will be used for identification.
    Note, that every context needs a unique name.
    Also note, that context-names are case-sensitive.

  • Bullet Library
    A reference to the bullet library which will be used by this context.

  • Time Scale
    Defines the time scale (usually 1.0) of all bullet-sources that are operating on this context. This value can be used for slowdown- or speedup-effects as well as debugging purposes.
    Note, that this value scales with Unity's Time.deltaTime if the DanmakuController is using second-based timing.

  • Targets
    A set of Transforms that will be used to determine targets which your bullets can be aimed at.
    Targets are mainly used by the aim-action in DanmakuJSON.
    Note, that you can register and unregister targets at runtime.

  • Bullet Container
    A reference to a Transform in your scene which will be used as the parent of all spawned bullet-sources.
    Note, that you don't have to define a bullet container but it's recommended to keep your object hierarchy clean at runtime.

  • Global Variables
    A set of named values which can be used in DanmakuJSON's Terms.
    In the example project, we defined the variable "rank" which can be used in bullet-patterns that scale dynamically with your game's difficulty (several danmaku-games do that).
    Note, that you can also define your own functions for resolving global variables.


Buy the Danmaku Engine plugin

Leave a comment