API Docs for:
Show:

SpellInvoking Class

A component class which allows an entity to combine colors to cast spells.

Constructor

SpellInvoking

(
  • invokingPatterns
  • colorQueueLength
  • canUseCyan
  • canUseMagenta
  • canUseYellow
)

Parameters:

  • invokingPatterns Object

    An object holding patterns and corresponding spells. See example for more.

  • colorQueueLength Number

    Number of non-unique colors per pattern.

  • canUseCyan Boolean

    Specifies whether the entity can use cyan when combining colors.

  • canUseMagenta Boolean

    Specifies whether the entity can use magenta when combining colors.

  • canUseYellow Boolean

    Specifies whether the entity can use yellow when combining colors.

Example:

   //Invoking patterns should be in this form:
   var invokingPatterns = {
       ccc : 'cyanMissile',
       cym : 'flare'
   };

   //The property names on the object describe color combinations.
   //Each letter corresponds to a different color, c for cyan, y for yellow and m for magenta.
   //The order of colors on the property name doesn't matter, only the count of each individual color.
   //The values are strings holding names of spells that correspond to the pattern on the property name.

Methods

clearColorQueue

()

Sets all queued colors to null.

colorAt

(
  • index
)
String | Null

Returns a color at a given index in the color queue.

Parameters:

  • index Number

    Index of the color in the queue. If this index is out of bounds, returns null.

Returns:

String | Null: Returns 'c' for cyan, 'y' for yellow and 'm' for magenta. Returns null if the color was not set or if the provided index is out of bounds.

getCanUseCyan

() Boolean

Returns:

Boolean:

getCanUseMagenta

() Boolean

Returns:

Boolean:

getCanUseYellow

() Boolean

Returns:

Boolean:

getColorQueueLength

() Number

Returns:

Number:

getInvokingPatterns

() Object | Null

Returns:

Object | Null: Direct reference to the pattern object. If the object wasn't set, returns null.

setCanUseCyan

(
  • canUseCyan
)

Parameters:

  • canUseCyan Boolean

    Specifies whether the entity can use cyan when combining colors.

setCanUseMagenta

(
  • canUseMagenta
)

Parameters:

  • canUseMagenta Boolean

    Specifies whether the entity can use magenta when combining colors.

setCanUseYellow

(
  • canUseYellow
)

Parameters:

  • canUseYellow Boolean

    Specifies whether the entity can use yellow when combining colors.

setColorQueueLength

(
  • colorQueueLength
)

Parameters:

  • colorQueueLength Number

    Number of non-unique colors per pattern.

setInvokingPatterns

(
  • invokingPatterns
)

Parameters:

  • invokingPatterns Object

    An object holding patterns and corresponding spells. See constructor example for more.