SpellInvoking Class
A component class which allows an entity to combine colors to cast spells.
Constructor
SpellInvoking
-
invokingPatterns
-
colorQueueLength
-
canUseCyan
-
canUseMagenta
-
canUseYellow
Parameters:
-
invokingPatterns
ObjectAn object holding patterns and corresponding spells. See example for more.
-
colorQueueLength
NumberNumber of non-unique colors per pattern.
-
canUseCyan
BooleanSpecifies whether the entity can use cyan when combining colors.
-
canUseMagenta
BooleanSpecifies whether the entity can use magenta when combining colors.
-
canUseYellow
BooleanSpecifies 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.
Item Index
Methods
clearColorQueue
()
Sets all queued colors to null.
colorAt
-
index
Returns a color at a given index in the color queue.
Parameters:
-
index
NumberIndex of the color in the queue. If this index is out of bounds, returns null.
Returns:
getCanUseCyan
()
Boolean
Returns:
getCanUseMagenta
()
Boolean
Returns:
getCanUseYellow
()
Boolean
Returns:
getColorQueueLength
()
Number
Returns:
getInvokingPatterns
()
Object | Null
Returns:
setCanUseCyan
-
canUseCyan
Parameters:
-
canUseCyan
BooleanSpecifies whether the entity can use cyan when combining colors.
setCanUseMagenta
-
canUseMagenta
Parameters:
-
canUseMagenta
BooleanSpecifies whether the entity can use magenta when combining colors.
setCanUseYellow
-
canUseYellow
Parameters:
-
canUseYellow
BooleanSpecifies whether the entity can use yellow when combining colors.
setColorQueueLength
-
colorQueueLength
Parameters:
-
colorQueueLength
NumberNumber of non-unique colors per pattern.
setInvokingPatterns
-
invokingPatterns
Parameters:
-
invokingPatterns
ObjectAn object holding patterns and corresponding spells. See constructor example for more.