public override void Setup() { CCSprite target = new CCSprite(TestResource.s_pPathBlock); target.AnchorPoint = CCPoint.Zero; target.Scale = 3; m_pOuterClipper = new CCClippingNode(); CCAffineTransform tranform = CCAffineTransform.Identity; tranform = CCAffineTransform.ScaleCopy(tranform, target.ScaleX, target.ScaleY); m_pOuterClipper.ContentSize = CCAffineTransform.Transform(target.ContentSize, tranform); m_pOuterClipper.AnchorPoint = new CCPoint(0.5f, 0.5f); m_pOuterClipper.RunAction(new CCRepeatForever(new CCRotateBy(1, 45))); m_pOuterClipper.Stencil = target; CCClippingNode holesClipper = new CCClippingNode(); holesClipper.Inverted = true; holesClipper.AlphaThreshold = 0.05f; holesClipper.AddChild(target); m_pHoles = new CCNode(); holesClipper.AddChild(m_pHoles); m_pHolesStencil = new CCNode(); holesClipper.Stencil = m_pHolesStencil; m_pOuterClipper.AddChild(holesClipper); this.AddChild(m_pOuterClipper); var listener = new CCEventListenerTouchAllAtOnce(); listener.OnTouchesBegan = onTouchesBegan; AddEventListener(listener); }
public override void Setup() { const int depth = 9; CCNode parent = this; for (int i = 0; i < depth; i++) { int size = 225 - i * (225 / (depth * 2)); CCClippingNode clipper = new CCClippingNode(); clipper.ContentSize = new CCSize(size, size); clipper.AnchorPoint = new CCPoint(0.5f, 0.5f); clipper.Position = parent.ContentSize.Center; clipper.AlphaThreshold = 0.05f; clipper.RunAction(new CCRepeatForever(new CCRotateBy(i % 3 != 0 ? 1.33f : 1.66f, i % 2 != 0 ? 90 : -90))); parent.AddChild(clipper); CCNode stencil = new CCSprite(TestResource.s_pPathGrossini); stencil.Scale = 2.5f - (i * (2.5f / depth)); stencil.AnchorPoint = new CCPoint(0.5f, 0.5f); stencil.Position = clipper.ContentSize.Center; stencil.Visible = false; stencil.RunAction(new CCSequence(new CCDelayTime(i), new CCShow())); clipper.Stencil = stencil; clipper.AddChild(stencil); parent = clipper; } }