Skip to content

Commit 50b1a67

Browse files
committed
Added Group.countActive
1 parent f7cd3de commit 50b1a67

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

v3/src/gameobjects/group/Group.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,13 +344,15 @@ var Group = new Class({
344344
}
345345
},
346346

347-
getTotalUsed: function ()
347+
countActive: function (value)
348348
{
349+
if (value === undefined) { value = true; }
350+
349351
var total = 0;
350352

351353
for (var i = 0; i < this.children.size; i++)
352354
{
353-
if (this.children.entries[i].active)
355+
if (this.children.entries[i].active === value)
354356
{
355357
total++;
356358
}
@@ -359,6 +361,11 @@ var Group = new Class({
359361
return total;
360362
},
361363

364+
getTotalUsed: function ()
365+
{
366+
return this.countActive();
367+
},
368+
362369
getTotalFree: function ()
363370
{
364371
var used = this.getTotalUsed();

0 commit comments

Comments
 (0)