Ejemplo n.º 1
0
        /**********************************************************************
         *********************************************************************/
        //Receiver sends ACK
        public static void SendACKFor(int seqnum)
        {
            if (!stopEverything)
            {
                //define object
                float yPos = 15 + (65 * (28 - seqnum)); //where the box !starts!
                OldPipelineProtocolsACK pp;

                //smaller rectangle at --
                switch (seqnum)
                {
                case -1:
                    pp   = new OldPipelineProtocolsACK(seqnum, 5, 1);
                    yPos = yPos + 12;     //since it's smaller, it has to be a little further up, in order to look pretty
                    break;

                default:
                    pp = new OldPipelineProtocolsACK(seqnum, 0);
                    break;
                }
                pp.Position = new CCPoint(280, yPos);
                layer.AddChild(pp);

                //define action
                float timeToTake        = 5f;
                var   distance          = new CCPoint(80, yPos);              //82 to 278 = 278-82 = 196
                var   sendPackageAction = new CCMoveTo(timeToTake, distance); //this action moves the object 196 in x-direction within 5 seconds
                var   removeAction      = new CCRemoveSelf();                 //this action removes the object*/

                //define sequence of actions and apply to object
                var cc_seq1 = new CCSequence(sendPackageAction, removeAction);
                pp.RunAction(cc_seq1);
            }
        }
Ejemplo n.º 2
0
        /**********************************************************************
         *********************************************************************/
        public static void SlowDownAck(OldPipelineProtocolsACK aa, int xPos)
        {
            //stop running actions
            aa.StopAllActions();

            //define actions
            float yPos              = 15 + (65 * (28 - aa.seqnum));
            float timeToTake        = 8f;
            var   distance          = new CCPoint(80, yPos);
            var   sendPackageAction = new CCMoveTo(timeToTake, distance); //this action moves the Object to the CCPoint
            var   removeAction      = new CCRemoveSelf();                 //this action removes the object*/

            //define sequence of actions and apply to object
            var cc_seq1 = new CCSequence(sendPackageAction, removeAction);

            aa.RunAction(cc_seq1);
        }