Interface providing the "push"-methods that ScoreFlash offers.
Namespace: NarayanaGames.ScoreFlashComponentAssembly: Assembly-CSharp-firstpass (in Assembly-CSharp-firstpass.dll) Version: 0.0.0.0
public interface IScoreFlash
public interface IScoreFlash
In general, there are three ways of "pushing" messages using ScoreFlash:
PushLocal(...), PushScreen(...) and PushWorld(...). Each of these can be
used either with ScoreFlash.Instance (if you are using a single instance
of ScoreFlash in your scene), or ScoreFlashManager.Get("name of instance")
if you are using multiple instances of ScoreFlash in a single scene. You
can also use these methods directly when you have a reference to a ScoreFlash
instance in the script where you want to push the messages.
Each of these methods can be called with different sets of parameters depending
on your needs. You can either just use the text as parameter, or pass a color,
or GUIStyles. PushScreen and PushWorld also require coordinates.
The difference between PushLocal and the other two (Screen/World) is that PushLocal uses the
alignment set in the ScoreFlash instance under "Main Layout"; so it either
shows the message on top, or in the middle, or bottom of the screen.
PushScreen uses screen coordinates, so you could use this, for instance, to
easily push messages to the current mouse pointer position or the location
where a user taps the screen of a mobile device.
PushWorld uses "world coordinates". In other words, coordinates in the 3D space.
If you are using PushWorld with Vector3, Camera.main must return the correct camera
(if you're only using one camera this is never a problem, otherwise, the correct tag
must be set, and it must be set only on your main camera). This limitation does not
apply if you are using ScoreFlashFollow3D (which you have to attach to the game object
that the message should be pushed at); there you can assign the camera to be used
in ScoreFlashFollow3D.
Having this interface instead of directly using ScoreFlash
mostly helps with Intellisense because instead of giving you all the
MonoBehaviour stuff that you won't really be interested in when
using ScoreFlash, it only gives you the relevant methods. When
accessing ScoreFlash via
Get(String) or via
Instance this simplifies working with
ScoreFlash quite a bit. When using your own references to ScoreFlash,
you could keep a private variable of type IScoreFlash for this convenience.
Unfortunately, you cannot have public inspector variables of type
IScoreFlash, so it's up to you to typecast your reference from the
bloated ScoreFlash MonoBehaviour to a clean IScoreFlash object.