void OnTouchesEnded(List<CCTouch> touches, CCEvent touchEvent) { var monstersToDelete = new List<CCNode>(); var touch = touches[0]; var touchLocation = Layer.ScreenToWorldspace(touch.LocationOnScreen); foreach(var monster in _monstersOnScreen) { if(monster.BoundingBox.ContainsPoint(touchLocation)) { monstersToDelete.Add(monster); var m = _monsters[monster.Tag]; var splashPool = new CCSprite(m.SplashSprite); if(m.KillMethod == 1) { splashPool.Position = monster.Position; AddChild(splashPool); var fade = new CCFadeOut(3.0f); var remove = new CCCallFuncN (RemoveSprite); var sequencia = new CCSequence(fade, remove); CCSimpleAudioEngine.SharedEngine.EffectsVolume = 0.7f; CCSimpleAudioEngine.SharedEngine.PlayEffect("Sounds/SplatEffect"); splashPool.RunAction(sequencia); } else if(m.KillMethod == 2) { CCSimpleAudioEngine.SharedEngine.EffectsVolume = 1.0f; CCSimpleAudioEngine.SharedEngine.PlayEffect("Sounds/pew-pew-lei"); splashPool.Position = monster.Position; AddChild(splashPool); var fade = new CCFadeOut(3.0f); var particleEmitter = new CCCallFuncND(StartExplosion, monster); var sequencia = new CCSequence(particleEmitter, fade); CCSimpleAudioEngine.SharedEngine.EffectsVolume = 0.7f; CCSimpleAudioEngine.SharedEngine.PlayEffect("Sounds/SplatEffect"); splashPool.RunAction(sequencia); } break; } } foreach(var monster in monstersToDelete) { monster.StopAllActions(); _monstersOnScreen.Remove(monster); RemoveChild(monster); } }
public CCCallFuncNDState (CCCallFuncND action, CCNode target) : base(action, target) { CallFunctionND = action.CallFunctionND; Data = action.Data; }
public CCCallFuncNDState(CCCallFuncND action, CCNode target) : base(action, target) { CallFunctionND = action.CallFunctionND; Data = action.Data; }