// Use this for initialization
    void Awake()
    {
        InitCharacterMesh();

        changeTPoseToNPose();
        setUpSkeleton();

        // from old code
        Time.fixedDeltaTime = (float)0.04;
        characterTimer      = new TimeController();
        characterTimer.setTimeMillis(0);

        bapReceiver   = new BAPReceiver(NUMBER_OF_BAPS, BAP_RECEIVER_PORT);
        fapReceiver   = new FAPReceiver(NUMBER_OF_FAPS + 1, FAP_RECEIVER_PORT);
        audioReceiver = new AudioReceiver(AUDIO_RECEIVER_PORT);

        lastFAPFrame  = new AnimationParametersFrame(NUMBER_OF_FAPS + 1, 0);
        lastBAPFrame  = new AnimationParametersFrame(NUMBER_OF_BAPS, 0);
        cptFrames     = 0;
        commandSender = new CommandSender(GretaServersHost, CMD_SENDER_PORT);
        agentPlaying  = false;

        _currentAudioSource = getBone("Head").gameObject.AddComponent <AudioSource>();
        audioFilePlayer     = new AudioFilePlayer();
    }
Example #2
0
        private object InitalizeProcess()
        {
            CloudLog.Debug("{0} Initializing has started...", GetType().Name);
            var sw = new Stopwatch();

            sw.Start();

            if (!string.IsNullOrEmpty(_username))
            {
                var logonResponse = Request("Logon", new
                {
                    User     = _username,
                    Password = _password
                });

                Debug.WriteSuccess(GetType().Name + " Login Response", logonResponse);
            }

            if (_components.Count == 0)
            {
                CloudLog.Debug("{0} has no component details... requesting...", GetType().Name);
                var response = Request("Component.GetComponents", null);

                CloudLog.Debug("QsysCore has received list of user defined components, count = {0}",
                               response.Result.Children().Count());

                foreach (var component in response.Result.Children())
                {
                    CloudLog.Debug("QsysCore has compononent \"{0}\"", component["Name"].Value <string>());
                }

                foreach (var component in response.Result.Children()
                         .Where(c => _userDefinedComponentNames.Contains(c["Name"].Value <string>())))
                {
                    var name = component["Name"].Value <string>();
                    if (_components.ContainsKey(name))
                    {
                        continue;
                    }
                    switch (component["Type"].Value <string>())
                    {
                    case "audio_file_player":
                        _components[name] = new AudioFilePlayer(this, component);
                        break;

                    case "mixer":
                        _components[name] = new Mixer(this, component);
                        break;

                    case "system_mute":
                    case "gain":
                        _components[name] = new Gain(this, component);
                        break;

                    case "scriptable_controls":
                        _components[name] = new ScriptableControls(this, component);
                        break;

                    case "snapshot_controller":
                        _components[name] = new SnapshotController(this, component);
                        break;

                    case "softphone":
                        _components[name] = new SoftPhone(this, component);
                        break;

                    case "pots_control_status_core":
                        _components[name] = new PotsPhone(this, component);
                        break;

                    case "signal_presence":
                        _components[name] = new SignalPresence(this, component);
                        break;

                    case "sine":
                        _components[name] = new Sine(this, component);
                        break;

                    case "router_with_output":
                        _components[name] = new RouterWithOutput(this, component);
                        break;

                    case "io_status":
                        _components[name] = new IoStatus(this, component);
                        break;

                    default:
                        _components[name] = new GenericComponent(this, component);
                        break;
                    }
                }
            }
            else
            {
                CloudLog.Debug("{0} has component details... updating...", GetType().Name);
                foreach (var component in this)
                {
                    component.UpdateAsync();
                }
            }

            _initialized = true;

            sw.Stop();
            CloudLog.Debug("{0} has initialized, process time = {1}", GetType().Name, sw.Elapsed);

            OnHasIntitialized(this);

            DefaultChangeGroup.PollAuto(1.0);

            return(null);
        }
Example #3
0
        //---------------------------------------------------------------------------------------------------------------------------------------------------------
        //                                                                    FORM LOAD
        //---------------------------------------------------------------------------------------------------------------------------------------------------------
        private void Form1_Load(object sender, EventArgs e)
        {
            // sets background image of start page
            BackgroundImage = Image.FromFile(Application.StartupPath + @"\mainBack.jpg", true);

            // creates event handler for start button
            startBtn.Click += StartBtn_Click;
            //sets width of start button
            startBtn.Width = 500;
            //sets height of start button
            startBtn.Height = 50;
            //creates the start button
            this.Controls.Add(startBtn);
            //changes colour of start button
            startBtn.BackColor = Color.Black;

            // creates event handler for exit button
            exitBtn.Click += ExitBtn_Click;
            //sets text of exit button
            exitBtn.Text = "Exit";
            //sets width of exit button
            exitBtn.Width = 150;
            //sets height of exit button
            exitBtn.Height = 100;
            //brings exit button to front
            exitBtn.BringToFront();
            //creates the exit button
            this.Controls.Add(exitBtn);
            //changes colour of exit button
            exitBtn.BackColor = Color.Black;

            // creates event handler for help button
            helpBtn.Click += HelpBtn_Click;
            //sets text of help button
            helpBtn.Text = "Instructions";
            //sets width of help button
            helpBtn.Width = 160;
            //sets height of help button
            helpBtn.Height = 100;
            //brings help button to front
            helpBtn.BringToFront();
            //creates the help button
            this.Controls.Add(helpBtn);
            //changes colour of help button
            helpBtn.BackColor = Color.Black;

            //sets location for the start button
            startBtn.Location = new Point((this.ClientSize.Width / 2 - startBtn.Width / 2 + 240), (this.ClientSize.Height / 2 - startBtn.Height + 250));
            //sets location for the help button
            helpBtn.Location = new Point(590, 560);
            //sets location for the exit Button
            exitBtn.Location = new Point(0, 560);

            // stop screen from blinking
            this.DoubleBuffered = true;
            //change screen height
            this.Height = screenHeight;
            //change screen width
            this.Width = screenWidth;
            //change text of form
            this.Text = "Galaxy Invaders";
            // change start position of form
            this.StartPosition = FormStartPosition.CenterScreen;
            // stop user from maximizing form
            this.MaximizeBox = false;

            //creates event handler for paint
            this.Paint += Form1_Paint;

            //constructs the List for bullets
            bulletRect = new List <Rectangle>();
            //constructs the List for enemies
            enemyRectList = new List <Rectangle>();
            //constructs the List for enemy health
            eHealth = new List <int>();

            //creates font collection
            fontCollection = new PrivateFontCollection();
            //gets font from file
            fontCollection.AddFontFile(Application.StartupPath + @"\square.ttf");
            //gets font from file
            fontCollection.AddFontFile(Application.StartupPath + @"\Android 101.ttf");

            //set main font to fontcollection and set its family and size
            mainFont = new Font(fontCollection.Families[1], 40);
            //set game font to fontcollection and set its family and size
            gameFont = new Font(fontCollection.Families[0], 14);

            //gets image from file for player
            image = Image.FromFile(Application.StartupPath + @"\player.png", true);
            //gets image from file for bullet
            image4 = Image.FromFile(Application.StartupPath + @"\bullet.png", true);
            //gets image from file for enemy
            image2 = Image.FromFile(Application.StartupPath + @"\enemy.png", true);
            //gets image from file for background
            mainBackground = Image.FromFile(Application.StartupPath + @"\mainBack.jpg", true);

            //creates event handler for mouse up
            this.MouseUp += Form1_MouseUp;
            //creates event handler for mouse move
            this.MouseMove += Form1_MouseMove;
            //creates event handler for mouse click
            this.MouseClick += Form1_MouseClick;
            //creates event handler for mouse down
            this.MouseDown += Form1_MouseDown;


            //creates the interval for the refresh timer
            refresh.Tick += Refresh_Tick;
            //sets the interval for the timer
            refresh.Interval = 5;
            //starts the timer
            refresh.Start();

            //checks to see if the file exists
            if (File.Exists(Application.StartupPath + @"\highscore.txt"))
            {
                //reads what is written in the file
                StreamReader hScore = new StreamReader(Application.StartupPath + @"\highscore.txt");

                //converts the number from the file into an integer and uses that as variable for highscore
                highscore = Convert.ToInt32(hScore.ReadLine());

                //closes the file
                hScore.Close();
            }

            //variable sets as audioplayer
            shootSound = new AudioFilePlayer();
            //gets sound from file
            shootSound.setAudioFile(Application.StartupPath + @"\shoot.mp3");

            //variable sets as audioplayer
            backMusic = new AudioFilePlayer();
            //gets sound from file
            backMusic.setAudioFile(Application.StartupPath + @"\backMusic.mp3");
        }
Example #4
0
 private void Form1_Load(object sender, EventArgs e)
 {
     //double buffered
     this.DoubleBuffered = true;
     //set sprite timer interval
     spriteTimer.Interval = 250;
     //set refresh timer interval
     refreshTimer.Interval = (1000 / 60);
     //set reload timer interval
     reloadTimer.Interval = 500;
     //start sprite timer
     spriteTimer.Start();
     //start refresh timer
     refreshTimer.Start();
     //create reload timer tick
     reloadTimer.Tick += ReloadTimer_Tick;
     //set form location
     this.Location = new Point(0, 0);
     //set form size
     this.MinimumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
     //set form size
     this.MaximumSize = this.MinimumSize;
     //prevent minimizing window
     this.MinimizeBox = false;
     //prevent maximizing window
     this.MaximizeBox = false;
     //set horizontal location of start button
     startBtn.Left = this.ClientSize.Width / 2 - 100;
     //set vertical location of start button
     startBtn.Top = this.ClientSize.Height / 2 - 50;
     //make start button visible
     startBtn.Visible = true;
     //set start button size
     startBtn.Width = 200;
     //set start button size
     startBtn.Height = 100;
     //set start button text
     startBtn.Text = "Start";
     //set horizontal location of how to play button
     howToPlayBtn.Left = this.ClientSize.Width / 2 - 100;
     //set vertical location of how to play button
     howToPlayBtn.Top = this.ClientSize.Height / 3 - 50;
     //make start button visible
     howToPlayBtn.Visible = true;
     //set start button size
     howToPlayBtn.Width = 200;
     //set start button size
     howToPlayBtn.Height = 100;
     //set start button text
     howToPlayBtn.Text = "How To Play";
     //create how to play button method
     howToPlayBtn.Click += HowToPlayBtn_Click;
     //add how to play button to form
     this.Controls.Add(howToPlayBtn);
     //set horizontal location of how to play button
     MenuBtn.Left = 0;
     //set vertical location of how to play button
     MenuBtn.Top = 0;
     //make start button visible
     MenuBtn.Visible = true;
     //set start button size
     MenuBtn.Width = 50;
     //set start button size
     MenuBtn.Height = 50;
     //set start button text
     MenuBtn.Text = "Menu";
     //create how to play button method
     MenuBtn.Click += MenuBtn_Click;
     //create form 1 paint
     this.Paint += Form1_Paint;
     //create mouse click mehtod
     MouseClick += Form1_MouseClick;
     //create refresh tick
     refreshTimer.Tick += RefreshTimer_Tick;
     //create sprite timer tick method
     spriteTimer.Tick += SpriteTimer_Tick;
     //add button to form
     this.Controls.Add(startBtn);
     //start button method
     startBtn.Click += StartBtn_Click;
     //declare values for backgroundrect
     backgroundRect = new Rectangle(0, 0, this.ClientSize.Width, this.ClientSize.Height);
     //assign value to ground
     ground = this.ClientSize.Height * 0.6;
     //add duck sprites to ducksprite right
     duckSpriteRight[0] = Image.FromFile(Application.StartupPath + @"\DuckRight0.png", true);
     duckSpriteRight[1] = Image.FromFile(Application.StartupPath + @"\DuckRight1.png", true);
     duckSpriteRight[2] = Image.FromFile(Application.StartupPath + @"\DuckRight2.png", true);
     duckSpriteRight[3] = Image.FromFile(Application.StartupPath + @"\DuckRight1.png", true);
     //add duck sprites to ducksprite left
     duckSpriteLeft[0] = Image.FromFile(Application.StartupPath + @"\DuckLeft0.png", true);
     duckSpriteLeft[1] = Image.FromFile(Application.StartupPath + @"\DuckLeft1.png", true);
     duckSpriteLeft[2] = Image.FromFile(Application.StartupPath + @"\DuckLeft2.png", true);
     duckSpriteLeft[3] = Image.FromFile(Application.StartupPath + @"\DuckLeft1.png", true);
     //add duck sprites to ducksprite falling
     duckSpriteFalling[0] = Image.FromFile(Application.StartupPath + @"\DuckDeadRight.png", true);
     duckSpriteFalling[1] = Image.FromFile(Application.StartupPath + @"\DuckDeadLeft.png", true);
     //add ammo box images to array
     ammoSprite[0] = Image.FromFile(Application.StartupPath + @"\Ammo0.png", true);
     ammoSprite[1] = Image.FromFile(Application.StartupPath + @"\Ammo1.png", true);
     ammoSprite[2] = Image.FromFile(Application.StartupPath + @"\Ammo2.png", true);
     ammoSprite[3] = Image.FromFile(Application.StartupPath + @"\Ammo3.png", true);
     //setup font
     fontCollection = new PrivateFontCollection();
     fontCollection.AddFontFile(Application.StartupPath + @"\Font.TTF");
     customFont = new Font(fontCollection.Families[0], 16);
     //add values to HTPRect
     HTPRect = new Rectangle(this.ClientSize.Width / 3, this.ClientSize.Height, this.ClientSize.Width / 3, this.ClientSize.Height);
     //setup music audio player
     Music = new AudioFilePlayer();
     Music.setAudioFile(Application.StartupPath + @"\DuckHuntMedley.mp3");
     //play music on loop
     Music.playLooping();
     //set up shootSound player
     shootSound = new AudioFilePlayer();
     shootSound.setAudioFile(Application.StartupPath + @"\ShootingSound.wav");
     //place ammo display rect on form
     ammoDisplayRect = new Rectangle(Convert.ToInt32(this.ClientSize.Width * (1.0 / 8.0)), Convert.ToInt32(this.ClientSize.Height * (5.0 / 6.0)), ammoSprite[0].Width * 5, ammoSprite[0].Height * 5);
     //place score display rect on form
     playerScoreDisplayRect = new Rectangle(Convert.ToInt32(this.ClientSize.Width * (3.0 / 4.0)), Convert.ToInt32(this.ClientSize.Height * (5.0 / 6.0)), scoreDisplaySprite.Width * 5, scoreDisplaySprite.Height * 5);
     //place game over rect on form
     gameOverRect = new Rectangle((this.ClientSize.Width / 2) - Convert.ToInt32(gameOverSprite.Width * (5.0 / 2.0)), this.ClientSize.Height / 2, gameOverSprite.Width * 5, gameOverSprite.Height * 5);
     //place score rect on form
     scoreRect = new Rectangle(Convert.ToInt32(this.ClientSize.Width * (3.0 / 4.0)) + scoreDisplaySprite.Width, Convert.ToInt32(this.ClientSize.Height * (5.0 / 6.0) + scoreDisplaySprite.Height), scoreDisplaySprite.Width * 5, scoreDisplaySprite.Height * 5);
 }