public override void OnEnter() { // // This test MUST be done in 'onEnter' and not on 'init' // otherwise the paused action will be resumed at 'onEnter' time // base.OnEnter(); CCSize s = Layer.VisibleBoundsWorldspace.Size; CCLabelTtf l = new CCLabelTtf("After 5 seconds grossini should move", "arial", 16); AddChild(l); l.Position = (new CCPoint(s.Width / 2, 245)); // // Also, this test MUST be done, after [super onEnter] // CCSprite grossini = new CCSprite(s_pPathGrossini); AddChild(grossini, 0, kTagGrossini); grossini.Position = (new CCPoint(200, 200)); CCAction action = new CCMoveBy(1, new CCPoint(150, 0)); grossini.AddAction(action, true); Schedule(unpause, 3); }
private void PlayPauseTapped() { _play.Visible = !_play.Visible; _pause.Visible = !_pause.Visible; if (_play.Visible) { _play.AddAction(_fadein); OnTapped?.Invoke(false); } else { _pause.AddAction(_fadein); OnTapped?.Invoke(true); } }
private void SetActiveSprite(bool soundEnabled) { _soundOn.Visible = soundEnabled; _soundOff.Visible = !soundEnabled; if (soundEnabled) { _soundOn.AddAction(_fadein); } else { _soundOff.AddAction(_fadein); } }
void OnTouchesBegan(List <CCTouch> touches, CCEvent touchEvent) { if (touches.Count > 0) { var touch = touches[0]; if (_sprite.BoundingBoxTransformedToWorld.ContainsPoint(touch.Location)) { _sprite.AddAction(_fadein); if (OnTapped != null) { OnTapped.Invoke(this); } } } }
public void AddAnimation(string name, float delay, bool repeat) { CCAction newAction; var animFrames = spriteSheet.Frames.FindAll(item => item.TextureFilename.ToLower().Contains(name)); if (spriteSize == CCSize.Zero) { spriteSize = animFrames[0].ContentSize; } if (repeat) { newAction = new CCRepeatForever(new CCAnimate(new CCAnimation(animFrames, delay))); } else { newAction = new CCRepeat(new CCAnimate(new CCAnimation(animFrames, delay)), 1); } sprite.AddAction(newAction); anims.Add(name, newAction); }
internal void FadeIn() { _sprite.AddAction(_fadein); }