public override void OnJoyStickButtonPressed(SneakyButtonStatus status, int id) { if (status == SneakyButtonStatus.Release) { Console.WriteLine("Button{0} pressed", id); if (id == 1) { HeroAttack(); return; } if (id == 2) { return; } } }
public override void OnJoyStickButtonPressed(SneakyButtonStatus status, int id) { //LOGIC WHEN PLAYER PRESS BUTTON : Obj.UserData sends the button pressed if (status == SneakyButtonStatus.Press) { if (_gameOver) return; Console.WriteLine("Button{0} pressed", id); if (id == 1) { PlayEffect(@"snd/laser_ship"); CCSprite shipLaser = _shipLasers[_nextShipLaser]; _nextShipLaser++; if (_nextShipLaser >= _shipLasers.Count) _nextShipLaser = 0; shipLaser.Position = Player.Position + new CCPoint(shipLaser.ContentSize.Width * .5f, 0); shipLaser.Visible = true; shipLaser.StopAllActions(); shipLaser.RunAction(new CCSequence( new CCMoveBy(0.5f, new CCPoint(Window.WindowSizeInPixels.Width + 50, 0)), new CCCallFuncN(SetInvisible) ) ); return; } if (id == 2) { // PlayerFire(player); return; } } }
/// <summary> /// Is executed when the player press a SneakyJoystick button. /// </summary> /// <param name="status">Indiques button status Pressed/Released</param> /// <param name="id">Button Id pressed</param> public virtual void OnJoyStickButtonPressed(SneakyButtonStatus status, int id) { }
public SneakyButtonEventResponse(SneakyButtonStatus responseType, int id, object userData) { ResponseType = responseType; UserData = userData; ID = id; }