Example #1
0
        public void stop()
        {
            isActive = false;
            collectSound.stop();
            switch (EFFECT_NR)
            {
            case 0:     // turn
                DsAPI.DsSendStringCommand("eye attitude cartesian rate 0 0 0 duration 1");
                break;

            case 1:     // Border
                moveUpBorder(false);
                break;

            case 2:     // Siren
                DsAPI.DsSendStringCommand("sirens_effect intensity 0 duration 1");
                DsAPI.DsSendStringCommand("sirens_effect attitude cartesian rate 0 0 0 duration 3 ");
                break;

            case 3:     // Eraser
                break;

            case 4:     // Flashbomb
                break;
            }
        }
Example #2
0
 public void activate()
 {
     DsAPI.DsSendStringCommand("startlabel" + NR_IN_DS + " modelTexture 0 " + Game.path + "img/label/label_check.dds");
     DsAPI.DsSendStringCommand("startlabel" + NR_IN_DS + " intensity 100");
     isActive = true;
     Game.numberOfActivePlayers++;
 }
Example #3
0
        public void Render()
        {
            // an den Digistar senden
            for (int i = 0; i < players.Length; i++)
            {
                if (players[i] != null && players[i].isAlive)
                {
                    players[i].renderPos();
                    textValue.Value = Convert.ToString(players[i].points);
                    DsAPI.DsSetObjectAttr(pointsObjId[i], t2cTextAttrIndex, textValue, true);
                }
            }

            // an den Digistar senden
            for (int i = 0; i < items.Length; i++)
            {
                if (items[i].justSpawned)
                {
                    items[i].renderPos();
                }
                if (items[i].justCollected)
                {
                    items[i].remove();
                    items[i].start();
                }

                if (items[i].isActive)
                {
                    items[i].timer();
                }
            }
        }
Example #4
0
        public void RoundDone()
        {
            for (int i = 0; i < numberOfControllers; i++)
            {
                DsAPI.DsSendStringCommand("trail" + players[i].NR_IN_DS + " delete");
                DsAPI.DsSendStringCommand("scene remove snake" + players[i].NR_IN_DS);
            }


            for (int i = 0; i < items.Length; i++)
            {
                if (items[i].onscreen)
                {
                    items[i].remove();
                }
                if (items[i].isActive)
                {
                    items[i].stop();
                }
            }


            gameLoop.setVolume(0, 4);

            items[1].resetBorder();

            if (numberOfWinners > 0)
            {
                GameDone(false);                      // false, because not an debug action
            }
            else
            {
                RoundInit();
            }
        }
Example #5
0
 // render method for digistar
 public void renderPos()
 {
     // Set Attribut usring Ref
     positionValue.Azimuth   = x;
     positionValue.Elevation = y;
     positionValue.Distance  = 11;
     DsAPI.DsSetObjectAttr(objId, positionAttrIndex, positionValue, true);
 }
Example #6
0
        // Menu ----------------------------------------

        public void MenuInit()
        {
            Script.PlaySkript(Properties.Resources.MenuFadeIn);
            DsAPI.DsSendStringCommand("eye attitude cartesian -90 0 0");
            DsAPI.DsSendStringCommand("eye attitude cartesian rate -1 0 0 duration 1");
            status = "menu";
            Thread.Sleep(2000);
        }
Example #7
0
        public void Instructions()
        {
            Script.PlaySkript(Properties.Resources.InitIntstr);
            DsAPI.DsSendStringCommand("js play " + path + "/DsScripts/instructions.js");
            Thread.Sleep(75000);

            Script.PlaySkript(Properties.Resources.InstrDone);
            status = "init";
        }
Example #8
0
        public void MenuCtrl()
        {
            if (controllers[0] != null)
            {
                JoystickState state = controllers[0].GetCurrentState();

                // Check if MenuElement is being seleceted for color change
                // Got through all MenuElements and check if they're selected
                for (int i = 0; i < MenuElements.Length; i++)
                {
                    if (MenuElements[i].selected)
                    {
                        DsAPI.DsSendStringCommand("menuitem" + i + " color 100 100 100");

                        if (menuTimeOut == 12)
                        {
                            if (state.Y / 100 < 100 && i != 0) // stir up
                            {
                                MenuElements[i].selected     = false;
                                MenuElements[i - 1].selected = true;
                                menuMoveSound.play();
                                break;
                            }
                            if (state.Y / 100 > 500 && i < MenuElements.Length - 1) // stir down
                            {
                                MenuElements[i].selected     = false;
                                MenuElements[i + 1].selected = true;
                                menuMoveSound.play();

                                break;
                            }
                        }

                        // Check if MenuElement is being hit

                        if (state.Buttons[0])
                        {
                            status = "";
                            menuSelectSound.play();
                            MenuDone(MenuElements[i].name);
                        }
                    }
                    else // if they're not selecetd, grey 'em out
                    {
                        DsAPI.DsSendStringCommand("menuitem" + i + " color 66 66 66");
                    }
                }



                menuTimeOut--;
                if (menuTimeOut == 0)
                {
                    menuTimeOut = 12;
                }
            }
        }
Example #9
0
        public Item(int number)
        {
            NR        = number;
            NR_IN_DS  = number + 1;
            NAME      = "item" + NR_IN_DS;
            EFFECT_NR = number;
            isActive  = false;
            onscreen  = false;
            x         = -5;
            y         = -5;

            switch (number)
            {
            case 0:     // Turn
                duration = 200;
                break;

            case 1:     // Move up border
                duration = 90;
                break;

            case 2:     // Siren
                duration = 200;
                break;

            case 3:     // Eraser
                duration = 600;
                break;

            case 4:     // Flash
                duration = 200;
                break;
            }

            collectSound = new Sound("item" + NR + "_collect");

            // Get Class ID
            DsAPI.DsGetClassID("solidModelClass", out solidModelClassId);

            // Get Attribute Index
            DsAPI.DsGetClassAttrIndex(solidModelClassId, "position", out positionAttrIndex);

            // Get Class Attribut ID
            DsAPI.DsGetClassAttrEnumID(solidModelClassId, positionAttrIndex, out solidModelClassPositionId);

            // Get Object
            DsAPI.DsGetObjectID("item" + NR_IN_DS, out objId);
            positionValueSph.PositionMode = 2; // Set the position mode to spherical

            if (number == 1)                   // border item
            {
                DsAPI.DsGetObjectID("item" + NR_IN_DS + "_warning", out objIdWarning);
                DsAPI.DsGetObjectID("item" + NR_IN_DS + "_border", out objIdBorder);
            }
        }
Example #10
0
        public void play()
        {
            if (playing)
            {
                DsAPI.DsSendStringCommand(name + " stop");
            }

            DsAPI.DsSendStringCommand(name + " play");
            playing    = true;
            startFrame = Game.frame;
        }
Example #11
0
 public void setVolume(int newVol, int duration = 0)
 {
     if (duration == 0)
     {
         DsAPI.DsSendStringCommand(name + " volume " + newVol);
     }
     else
     {
         DsAPI.DsSendStringCommand(name + " volume " + newVol + " duration " + duration);
     }
 }
Example #12
0
        public void resetBorder()
        {
            borderY   = 0.5;
            borderZ   = 0;
            borderLvl = 0;

            positionValueCar.X = 0;
            positionValueCar.Y = 0;
            positionValueCar.Z = borderZ;
            DsAPI.DsSetObjectAttr(objIdWarning, positionAttrIndex, positionValueCar, true);
            DsAPI.DsSetObjectAttr(objIdBorder, positionAttrIndex, positionValueCar, true);
        }
Example #13
0
        public void PlaySkript(string skript)
        {
            lastTime = -1;

            skript = skript.Replace('\r', ' ');
            string[] lines = skript.Split('\n');
            for (int i = 0; i < lines.Length; i++)
            {
                // Look for relative paths in the commands and replace them
                string relPath = "..\\";
                if (lines[i].Contains(relPath))
                {
                    lines[i] = lines[i].Replace(relPath, Game.path);
                }
                if (lines[i].StartsWith("+"))
                {
                    sleeptime = Convert.ToDouble(lines[i].Substring(1, 1));
                    if (lines[i].Length > 4)
                    {
                        sleeptime += Convert.ToDouble(lines[i].Substring(3, 1)) / 10;
                    }

                    Thread.Sleep(Convert.ToInt32(sleeptime * 1000));
                }
                if (char.IsDigit(lines[i][0]))
                {
                    currenttime = Convert.ToDouble(lines[i].Substring(0, 1));

                    // Check if the line contains a coma, if yes, add .5 to the sleeptime
                    if (lines[i].Substring(1, 1).Equals("."))
                    {
                        currenttime += 0.5;
                    }


                    if (lastTime < 0)
                    {
                        sleeptime = currenttime;
                    }

                    else
                    {
                        sleeptime = currenttime - lastTime;
                    }

                    Thread.Sleep(Convert.ToInt32(sleeptime * 1000));
                    lastTime = currenttime;
                }

                DsAPI.DsSendStringCommand(lines[i]);
            }
        }
Example #14
0
 public void remove()
 {
     // Set Attribut usring Ref
     positionValueCar.Azimuth   = -5;
     positionValueCar.Elevation = -5;
     positionValueCar.Distance  = 11;
     DsAPI.DsSetObjectAttr(objId, positionAttrIndex, positionValueCar, true);
     DsAPI.DsSendStringCommand("scene remove item" + NR_IN_DS);
     DsAPI.DsSendStringCommand("item" + NR_IN_DS + " intensity 0 duration 1");
     // after being rendered, justSpawned can bet set to false again, so this item wont be rendered every frame
     // also we need to increment itemsOnScreen and set this item onscreen
     justCollected = false;
     Game.itemsOnscreen--;
     onscreen = false;
 }
Example #15
0
        public void PlayerSelect()
        {
            for (int i = 0; i < numberOfControllers; i++)
            {
                if (controllers[i] != null && !players[i].isActive)
                {
                    JoystickState state = controllers[i].GetCurrentState();
                    if (state.Buttons[0])
                    {
                        players[i].activate();
                        menuSelectSound.play();
                    }
                }
            }

            if (selectPlayersCountdown == 0 || numberOfActivePlayers == numberOfControllers)
            {
                DsAPI.DsSendStringCommand("SelectPlayer_Text intensity 0 dur 1");
                DsAPI.DsSendStringCommand("SelectPlayer_Countdown intensity 0 dur 1");



                if (numberOfActivePlayers < 2)
                {
                    for (int i = 0; i < numberOfControllers; i++)
                    {
                        DsAPI.DsSendStringCommand("scene remove startlabel" + players[i].NR_IN_DS);
                        players[i].isActive = false;
                    }
                    Thread.Sleep(1000);
                    status = "init";
                }
                else
                {
                    Thread.Sleep(1000);
                    GameInit();
                }
            }

            playerSelectTimeOut--;
            if (playerSelectTimeOut == 0)
            {
                selectPlayersCountdown--;
                DsAPI.DsSendStringCommand("SelectPlayer_Countdown text " + selectPlayersCountdown);

                playerSelectTimeOut = 50;
            }
        }
Example #16
0
        public void initPlayerSelect()
        {
            status = "playerSelect";
            selectPlayersCountdown = 30;
            numberOfActivePlayers  = 0;
            // Init character array
            for (int i = 0; i < numberOfControllers; i++)
            {
                players[i] = new Player(i);                                           // create player
            }
            // Init text objects
            DsAPI.DsSendStringCommand("SelectPlayer_Text intensity 80 dur 1");
            DsAPI.DsSendStringCommand("SelectPlayer_Countdown text " + selectPlayersCountdown);
            DsAPI.DsSendStringCommand("SelectPlayer_Countdown intensity 80 dur 1");

            // Set label position
            int    labelwidth       = 10;
            double offset           = -(labelwidth * (numberOfControllers - 2)) - 90;
            int    offsetAdjustment = -15;

            offsetAdjustment = offsetAdjustment + numberOfControllers * 5;

            offset += offsetAdjustment;

            /*if (numberOfControllers == 2) offset -= 5;
             * if (numberOfControllers == 4) offset += 5;
             * if (numberOfControllers == 5) offset += 10;
             * if (numberOfControllers == 6) offset += 15;
             * if (numberOfControllers == 7) offset += 20;
             * if (numberOfControllers == 8) offset += 25;*/

            for (int i = 0; i < numberOfControllers; i++)
            {
                positionValue.Azimuth   = offset;
                positionValue.Elevation = 10;
                positionValue.Distance  = 11;
                DsAPI.DsSetObjectAttr(startlabelObjId[i], smcPosAttrIndex, positionValue, true);
                DsAPI.DsSendStringCommand("startlabel" + players[i].NR_IN_DS + " intensity 60 dur 1");
                DsAPI.DsSendStringCommand("scene add startlabel" + players[i].NR_IN_DS);
                offset += labelwidth;
            }

            Thread.Sleep(600);
        }
Example #17
0
        // Initialization ------------------------------
        public void Init()
        {
            // Moving to the project folder
            while (currentFolder != "SNICE")
            {
                path          = Path.GetDirectoryName(path);
                currentFolder = Path.GetFileName(path);
            }
            // Add Backslash once we're in the right path
            path += "\\";


            Script = new DsScripts();
            Script.PlaySkript(Properties.Resources.SystemReset);
            DsAPI.DsSendStringCommand("eye int 0");
            Script.PlaySkript(Properties.Resources.InitBG);
            Script.PlaySkript(Properties.Resources.InitCounter);
            Script.PlaySkript(Properties.Resources.InitItemEffect);
            Script.PlaySkript(Properties.Resources.InitPoints);
            Script.PlaySkript(Properties.Resources.InitSelectPlayer);
            Script.PlaySkript(Properties.Resources.InitWinners);
            Script.PlaySkript(Properties.Resources.InitLabel);
            Script.PlaySkript(Properties.Resources.InitSound);
            Script.PlaySkript(Properties.Resources.InitSnakes);
            Script.PlaySkript(Properties.Resources.InitTrails);
            Script.PlaySkript(Properties.Resources.InitItem);
            Script.PlaySkript(Properties.Resources.InitMenu);

            Thread.Sleep(2200);


            // Sound Refs .....

            menuLoop        = new Sound("menuLoop");
            gameLoop        = new Sound("gameLoop");
            deathSound      = new Sound("death");
            menuSelectSound = new Sound("menuSelectSound");
            menuMoveSound   = new Sound("menuMoveSound");
            winSound        = new Sound("winSound");
            countdown       = new Sound("countdown");

            DsAPI.DsSendStringCommand("eye int 100 duration 2");
            menuLoop.loop();
            menuLoop.setVolume(70, 2);



            // Initialize Controllers

            numberOfControllers = 0;
            foreach (var deviceInstance in directInput.GetDevices(DeviceType.Gamepad,
                                                                  DeviceEnumerationFlags.AllDevices))
            {
                controllerGuids[numberOfControllers] = deviceInstance.InstanceGuid;                                     // Find a guid
                controllers[numberOfControllers]     = new Joystick(directInput, controllerGuids[numberOfControllers]); // Instantiate Joystick
                controllers[numberOfControllers].Acquire();                                                             // acquire joystick
                numberOfControllers++;
            }

            InitSections();

            for (int i = 0; i < MenuElements.Length; i++)
            {
                MenuElements[i] = new MenuElement(i);
            }

            for (int i = 0; i < items.Length; i++)
            {
                items[i] = new Item(i);
            }

            double startingElevation = 2.5;
            double startingAzimuth   = -174.38;

            for (int i = 0; i < itemYValues.Length; i++)
            {
                itemYValues[i]     = startingElevation;
                startingElevation += 5;
            }

            for (int i = 0; i < itemXValues.Length; i++)
            {
                itemXValues[i]   = startingAzimuth;
                startingAzimuth += 11.25;
            }


            // Set Position mode to sph
            positionValue.PositionMode = 2;
            // Get Ds Ids and stuff
            // SolidModelClass
            DsAPI.DsGetClassID("solidModelClass", out solidModelClassId);

            // Position
            DsAPI.DsGetClassAttrIndex(solidModelClassId, "position", out smcPosAttrIndex);
            // Scale
            DsAPI.DsGetClassAttrIndex(solidModelClassId, "scale", out smcScaleAttrIndex);
            // Intenstiy
            DsAPI.DsGetClassAttrIndex(solidModelClassId, "intensity", out smcIntAttrIndex);

            Thread.Sleep(1200);

            // Get Object IDs from DS
            DsAPI.DsGetObjectID("winners", out winnersObjId);
            DsAPI.DsGetObjectID("pointsTotal", out pointsTotalObjId);


            for (int i = 1; i <= numberOfControllers; i++)
            {
                DsAPI.DsGetObjectID("player" + i, out playerObjId[i - 1]);
                DsAPI.DsGetObjectID("snake" + i, out snakeObjId[i - 1]);
                DsAPI.DsGetObjectID("points" + i, out pointsObjId[i - 1]);
                DsAPI.DsGetObjectID("startlabel" + i, out startlabelObjId[i - 1]);
                DsAPI.DsGetObjectID("counter" + i, out counterObjId[i - 1]);
                DsAPI.DsGetObjectID("trail" + i, out trailObjId[i - 1]);
            }

            // Text2Class
            DsAPI.DsGetClassID("text2Class", out text2ClassId);
            // Attr
            DsAPI.DsGetClassAttrIndex(text2ClassId, "text", out t2cTextAttrIndex);
            DsAPI.DsGetClassAttrIndex(text2ClassId, "intensity", out t2cIntAttrIndex);
            DsAPI.DsGetClassAttrIndex(text2ClassId, "position", out t2cPosAttrIndex);
            DsAPI.DsGetClassAttrIndex(text2ClassId, "color", out t2cColAttrIndex);


            // Trail Class
            DsAPI.DsGetClassID("trailClass", out trailClassId);
            DsAPI.DsGetClassAttrIndex(trailClassId, "color", out trailColAttrIndex);
        }
Example #18
0
        // This method contains things that are set when a player is created ... meaning all CONSTANTS ...
        public Player(int number)
        {
            NR       = number;
            NR_IN_DS = number + 1;
            NAME     = "snake" + NR_IN_DS;

            switch (number)
            {
            case 0:
                RED   = 14;
                GREEN = 74;
                BLUE  = 100;
                break;

            case 1:
                RED   = 100;
                GREEN = 89;
                BLUE  = 0;
                break;

            case 2:
                RED   = 95;
                GREEN = 24;
                BLUE  = 25;
                break;

            case 3:
                RED   = 0;
                GREEN = 95;
                BLUE  = 2;
                break;

            case 4:
                RED   = 50;
                GREEN = 0;
                BLUE  = 100;
                break;

            case 5:
                RED   = 100;
                GREEN = 55;
                BLUE  = 7;
                break;

            case 6:
                RED   = 100;
                GREEN = 65;
                BLUE  = 75;
                break;

            case 7:
                RED   = 100;
                GREEN = 100;
                BLUE  = 79;
                break;
            }

            // Get Class ID
            DsAPI.DsGetClassID("emptyClass", out emptyClassId);

            // Get Attribute Index
            DsAPI.DsGetClassAttrIndex(emptyClassId, "position", out positionAttrIndex);

            // Get Object
            DsAPI.DsGetObjectID("snake" + NR_IN_DS, out objId);
            positionValue.PositionMode = 2; // Set the position mode to spherical
        }
Example #19
0
        // Game Strucutre ---------------------------------

        public void GameInit()
        {
            // Stop the music (fade out)
            gameLoop.setVolume(0, 5);
            // Change the background image to the game grid background
            DsAPI.DsSendStringCommand("BG_ss frame 4");
            // Fade the background image in
            DsAPI.DsSendStringCommand("BG intensity 100 duration 1");

            // Calculate the position for the player related objects such as startlabel, score, ect.
            // the distance between the objects depends on the number of players --> calc the angle
            double angle = 360 / numberOfControllers;

            // Init points, counter and startlabel
            for (int i = 0; i < numberOfControllers; i++)
            {
                double horizontalPlayerPosition = angle * i - 180; // calculate the objects position depending on player number with a 180 degree shift because values must go from -180 to 180
                // Set the points (text obejct)
                positionValue.Azimuth   = horizontalPlayerPosition;
                positionValue.Elevation = 83.2;
                positionValue.Distance  = 9;
                DsAPI.DsSetObjectAttr(pointsObjId[i], t2cPosAttrIndex, positionValue, true);
                textValue.Value = Convert.ToString(players[i].points);
                DsAPI.DsSetObjectAttr(pointsObjId[i], t2cTextAttrIndex, textValue, true);

                colorValue.Red   = players[i].RED;
                colorValue.Green = players[i].GREEN;
                colorValue.Blue  = players[i].BLUE;

                DsAPI.DsSetObjectAttr(pointsObjId[i], t2cColAttrIndex, colorValue, true);

                DsAPI.DsSendStringCommand("scene add points" + players[i].NR_IN_DS);
                // Set the counter (frame around points)
                DsAPI.DsSendStringCommand("points" + players[i].NR_IN_DS + " intensity 100 duration 2");
                DsAPI.DsSendStringCommand("counter" + players[i].NR_IN_DS + " modelTexture 0 " + path + "img/counter/Counter" + numberOfControllers + "-0" + i + ".png");
                DsAPI.DsSendStringCommand("counter" + players[i].NR_IN_DS + " attitude 0 -90 " + horizontalPlayerPosition);
                DsAPI.DsSendStringCommand("scene add counter" + players[i].NR_IN_DS);
                // Set the startlabel
                DsAPI.DsSendStringCommand("counter" + players[i].NR_IN_DS + " intensity 100 duration 2 ");
                DsAPI.DsSendStringCommand("startlabel" + players[i].NR_IN_DS + " position spherical " + horizontalPlayerPosition + " 5 11 dur 2");
                DsAPI.DsSendStringCommand("scene add startlabel" + players[i].NR_IN_DS);
            }

            // Calc and display points total (needed to win game)
            pointsTotal = numberOfControllers * pointsTotalFactor;

            textValue.Value = Convert.ToString(pointsTotal);
            if (pointsTotal == 6 || pointsTotal == 9)
            {
                textValue.Value += ".";                                       // append '.' so 6 and 9 are distinguishable
            }
            DsAPI.DsSetObjectAttr(pointsTotalObjId, t2cTextAttrIndex, textValue, true);

            DsAPI.DsSendStringCommand("pointstotal intensity 100 dur 1");
            DsAPI.DsSendStringCommand("pointstotal attitude cartesian rate 5 0 0 dur 1");

            // Stop the rotation of the eye
            DsAPI.DsSendStringCommand("eye attitude cartesian rate 0 0 0 duration 1");

            for (int i = 0; i < winners.Length; i++)
            {
                winners[i] = -1;
            }
            numberOfWinners = 0;

            // Init first round
            RoundInit();
        }
Example #20
0
 public void loop()
 {
     DsAPI.DsSendStringCommand(name + " loop");
     looping = true;
 }
Example #21
0
 public void stop()
 {
     DsAPI.DsSendStringCommand(name + " stop");
     playing = false;
     looping = false;
 }
Example #22
0
        public void RoundInit()
        {
            // Set the startlabels
            // Set player varibles right
            playersAlive = 0;
            for (int i = 0; i < numberOfControllers; i++)
            {
                playersAlive++;
                players[i].isAlive = true;
                players[i].dir     = "up";
                DsAPI.DsSendStringCommand("startlabel" + players[i].NR_IN_DS + " modelTexture 0 " + path + "/img/label/label.dds");
                DsAPI.DsSendStringCommand("startlabel" + players[i].NR_IN_DS + " int 100 dur 1");
            }


            // Inits Trails and Countdown

            Script.PlaySkript(Properties.Resources.InitTrails);

            double angle = 360 / numberOfControllers;

            //Display the snakes
            for (int i = 0; i < numberOfControllers; i++)
            {
                players[i].setPos(angle * i - 180, 5);
                positionValue.Azimuth   = players[i].x;
                positionValue.Elevation = players[i].y;
                positionValue.Distance  = 11;
                DsAPI.DsSetObjectAttr(snakeObjId[i], smcPosAttrIndex, positionValue, true);

                colorValue.Red   = players[i].RED;
                colorValue.Green = players[i].GREEN;
                colorValue.Blue  = players[i].BLUE;

                DsAPI.DsSetObjectAttr(trailObjId[i], trailColAttrIndex, colorValue, true);

                DsAPI.DsSendStringCommand("trail" + players[i].NR_IN_DS + " intensity 0");
                DsAPI.DsSendStringCommand("scene add snake" + players[i].NR_IN_DS);
            }

            Script.PlaySkript(Properties.Resources.Countdown);

            //Display the snakes
            for (int i = 0; i < numberOfControllers; i++)
            {
                DsAPI.DsSendStringCommand("trail" + players[i].NR_IN_DS + " intensity 100 dur 1");
            }

            // Empty the position arrays
            clearSections();
            // Wait for the countdown to end

            frame  = 0;
            status = "running";

            // Fade out the startlabels
            for (int i = 0; i < numberOfControllers; i++)
            {
                DsAPI.DsSendStringCommand("startlabel" + players[i].NR_IN_DS + " int 0 dur 1");
            }
        }
Example #23
0
        public static void GameDone(bool debug)
        {
            // ----------------------------------------------------------------------------------------
            if (debug)
            {
                for (int i = 0; i < numberOfControllers; i++)
                {
                    DsAPI.DsSendStringCommand("trail" + +players[i].NR_IN_DS + " delete");
                    DsAPI.DsSendStringCommand("scene remove snake" + players[i].NR_IN_DS);
                }
            }

            // -----------------------------------------------------------------------------------------

            DsAPI.DsSendStringCommand("BG intensity 0 duration 2");
            DsAPI.DsSendStringCommand("BG_ss frame 0");
            DsAPI.DsSendStringCommand("pointstotal intensity 0 dur 1");

            for (int i = 0; i < players.Length; i++)
            {
                if (players[i] != null)
                {
                    DsAPI.DsSendStringCommand("points" + players[i].NR_IN_DS + " intensity 0 duration 1");
                    DsAPI.DsSendStringCommand("counter" + players[i].NR_IN_DS + " intensity 0 duration 1");
                    DsAPI.DsSendStringCommand("startlabel" + players[i].NR_IN_DS + " intensity 0 duration 1");
                }
            }

            for (int i = 0; i < players.Length; i++)
            {
                if (players[i] != null)
                {
                    DsAPI.DsSendStringCommand("startlabel" + players[i].NR_IN_DS + " modelTexture 0 " + path + "/img/label/label_" + players[i].NR_IN_DS + ".dds");
                    DsAPI.DsSendStringCommand("scene remove points" + players[i].NR_IN_DS);
                    DsAPI.DsSendStringCommand("scene remove counter" + players[i].NR_IN_DS);
                    DsAPI.DsSendStringCommand("scene remove startlabel" + players[i].NR_IN_DS);
                }
            }


            DsAPI.DsSendStringCommand("eye reset");
            DsAPI.DsSendStringCommand("pointstotal intensity 0 dur 1");
            DsAPI.DsSendStringCommand("pointstotal attitude cartesian rate 0 0 0 dur 1");

            Thread.Sleep(100);



            DsAPI.DsSendStringCommand("BG intensity 100 duration 1");

            // Hier muss noch die Gameloopmusic auf null gesetzt werden und anhalten
            gameLoop.setVolume(0, 2);
            gameLoop.stop();
            //  Hier muss noch der gewinner sound abgespielt werden
            winSound.play();
            // Hier muss noch kontrolleirt werden wer alles gewonnen hat
            for (int i = 0; i < winners.Length; i++)
            {
                if (i == numberOfWinners - 1)
                {
                    int z = i + 1;
                    positionValue.Azimuth   = -90;
                    positionValue.Elevation = 5 * (z + 3);
                    positionValue.Distance  = 11;
                    DsAPI.DsSetObjectAttr(winnersObjId, smcPosAttrIndex, positionValue, true);
                    DsAPI.DsSendStringCommand("winners intensity 100 dur 1");
                }


                if (winners[i] > -1)
                {
                    positionValue.Azimuth   = -90;
                    positionValue.Elevation = 5 * (i + 3);
                    positionValue.Distance  = 11;
                    DsAPI.DsSetObjectAttr(playerObjId[winners[i]], smcPosAttrIndex, positionValue, true);

                    scaleValue.X = scaleValue.Y = scaleValue.Z = 0.5;
                    DsAPI.DsSetObjectAttr(playerObjId[winners[i]], smcScaleAttrIndex, scaleValue, true); // duration 2 fehlt noch

                    DsAPI.DsSendStringCommand("player" + players[winners[i]].NR_IN_DS + " intensity 100 dur 1");
                }
            }

            Thread.Sleep(4000);

            for (int i = 0; i < winners.Length; i++)
            {
                if (i == numberOfWinners - 1)
                {
                    int z = i + 1;
                    DsAPI.DsSendStringCommand("winners intensity 0 dur 1");
                }

                if (winners[i] > -1)
                {
                    scaleValue.X = scaleValue.Y = scaleValue.Z = 0;
                    DsAPI.DsSetObjectAttr(playerObjId[winners[i]], smcScaleAttrIndex, scaleValue, true); // duration 2 fehlt noch
                    DsAPI.DsSendStringCommand("player" + players[winners[i]].NR_IN_DS + " intensity 0 dur 1");
                }
            }

            Thread.Sleep(2000);

            for (int i = 0; i < numberOfControllers; i++)
            {
                players[i] = null;
            }

            status = "init"; // Initialize the menu
        }
Example #24
0
        public void moveUpBorder(bool isWarning)
        {
            short ID;

            if (isWarning)
            {
                ID = objIdWarning;
            }
            else
            {
                ID = objIdBorder;
            }

            if (borderY == 0.5)
            {
                borderZ = 131;
            }
            if (borderY == 10.5)
            {
                borderZ = 262;
            }
            if (borderY == 15.5)
            {
                borderZ = 400;
            }
            if (borderY == 20.5)
            {
                borderZ = 545;
            }
            if (borderY == 25.5)
            {
                borderZ = 700;
            }
            if (borderY == 30.5)
            {
                borderZ = 865;
            }
            if (borderY == 35.5)
            {
                borderZ = 1050;
            }
            if (borderY == 40.5)
            {
                borderZ = 1260;
            }
            if (borderY == 45.5)
            {
                borderZ = 1500;
            }
            if (borderY == 50.5)
            {
                borderZ = 1780;
            }
            if (borderY == 55.5)
            {
                borderZ = 2150;
            }
            if (borderY == 60.5)
            {
                borderZ = 2600;
            }
            if (borderY == 65.5)
            {
                borderZ = 3200;
            }
            if (borderY == 70.5)
            {
                borderZ = 4120;
            }
            if (borderY == 75.5)
            {
                borderZ = 5560;
            }
            if (borderY == 80.5)
            {
                borderZ = 9000;
            }

            positionValueCar.X = 0;
            positionValueCar.Y = 0;
            positionValueCar.Z = borderZ;
            DsAPI.DsSetObjectAttr(ID, positionAttrIndex, positionValueCar, true);

            if (isWarning)
            {
                DsAPI.DsSendStringCommand("script include " + Game.path + "DsScripts/Border_Item_Fade.ds");
            }

            else
            {
                // check if there is an item in this ring
                for (int i = 0; i < Game.items.Length; i++)
                {
                    if (Game.items[i].onscreen)
                    {
                        Game.items[i].remove();
                    }
                }

                borderY   += 5;
                borderLvl += 1;
            }
        }
Example #25
0
        public void start()
        {
            isActive = true;
            int effectDirection = rnd.Next(0, 1);

            collectSound.play();

            switch (EFFECT_NR)
            {
            case 0:     // Turn
                if (effectDirection == 0)
                {
                    DsAPI.DsSendStringCommand("eye attitude cartesian rate 10 0 0 duration 1");
                }
                else
                {
                    DsAPI.DsSendStringCommand("eye attitude cartesian rate -10 0 0 duration 1");
                }
                break;

            case 1:     // Border
                moveUpBorder(true);
                break;

            case 2:     // Siren
                DsAPI.DsSendStringCommand("sirens_effect intensity 90 duration 2");
                if (effectDirection == 0)
                {
                    DsAPI.DsSendStringCommand("sirens_effect attitude cartesian rate 200 0 0 duration 2 ");
                }
                else
                {
                    DsAPI.DsSendStringCommand("sirens_effect attitude cartesian rate -200 0 0 duration 2 ");
                }
                break;

            case 3:     // Eraser
                // delete trails
                for (int i = 0; i < Game.numberOfControllers; i++)
                {
                    DsAPI.DsSendStringCommand("trail" + Game.players[i].NR_IN_DS + " delete");
                }
                // delete items
                for (int i = 0; i < Game.items.Length; i++)
                {
                    if (Game.items[i].onscreen)
                    {
                        Game.items[i].justCollected = true;
                    }
                }

                // add trails
                Game.Script.PlaySkript(Properties.Resources.InitTrails);
                Thread.Sleep(200);
                for (int i = 0; i < Game.numberOfControllers; i++)
                {
                    Game.colorValue.Red   = Game.players[i].RED;
                    Game.colorValue.Green = Game.players[i].GREEN;
                    Game.colorValue.Blue  = Game.players[i].BLUE;

                    DsAPI.DsSetObjectAttr(Game.trailObjId[i], Game.trailColAttrIndex, Game.colorValue, true);
                }
                // init sections
                Game.InitSections();
                break;

            case 4:     // Flashbomb
                break;
            }
        }