Skip to content

Commit a99f939

Browse files
author
Jeffrey Lanters
authored
Merge pull request #21 from jeffreylanters/development
Added CanEmit
2 parents 0f4406c + 6762d3b commit a99f939

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,12 @@ export class App extends React.Component {
101101
constructor () {
102102
this.spawnEnemies = new UnityEvent ('SpawnBehaviour', 'SpawnEnemies')
103103
}
104+
onClickSpawnEnemies (count) {
105+
if (this.spawnEnemies.canEmit () === true)
106+
this.spawnEnemies.emit (count)
107+
}
104108
render () {
105-
return <div onClick={ this.spawnEnemies.emit (5) }>
109+
return <div onClick={ this.onClickSpawnEnemies.bind (this, 5) }>
106110
Click to Spawn 5 Enemies</div>
107111
}
108112
}

0 commit comments

Comments
 (0)