Inheritance: MonoBehaviour
Example #1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.layer == 21)
        {
            if (health > 0)
            {
                if (_timeUntilNextHitCounter == _timeUntilNextHit)
                {
                    PlaySound.PlayAudioFromSelection(_audioSource, _hitClips, true, -.15f, .15f);
                    //HeartBeatControl.HeartBeatPitchAmount(1.2f);
                    //print(other.gameObject.name);
                    _timeUntilNextHitCounter = 0;
                    //GlobalLowPassFilter.LowPassFilterAmount(500);
                    PostProcessControl.PlayerDamagePostEffect(_playerDamageVignetteAmnt, _playerDamageContrastAmnt);
                    _heartBeatPitch += .1f;
                    HeartBeatControl.HeartBeatPitchAmount(_heartBeatPitch);
                    StartCoroutine(HitHaptics(.25f));
                    //HapticFeedback.HapticAmount(1500, true, true);
                    health--;
                }

                if (health <= 1)
                {
                    //
                }
            }
            else
            {
                StartCoroutine(Death());
            }
        }
    }
Example #2
0
        public static void PlaySound(IPoint3D p, Map map, int soundID)
        {
            if (soundID == -1)
            {
                return;
            }

            if (map != null)
            {
                Packet playSound = null;

                IPooledEnumerable eable = map.GetClientsInRange(new Point3D(p));

                foreach (NetState state in eable)
                {
                    state.Mobile.ProcessDelta();

                    if (playSound == null)
                    {
                        playSound = new PlaySound(soundID, p);
                    }

                    state.Send(playSound);
                }

                eable.Free();
            }
        }
 // Start is called before the first frame update
 void Start()
 {
     pS            = GameObject.FindGameObjectWithTag("PlayerSFX");
     playSound     = pS.GetComponent <PlaySound>();
     currentHealth = maxHealth;
     healthBar.SetMaxHealth(maxHealth);
 }
Example #4
0
        private static void PlaySound(Mobile m, int index, bool toAll)
        {
            Map map = m.Map;

            if (map == null)
            {
                return;
            }

            CommandLogging.WriteLine(m, "{0} {1} playing sound {2} (toAll={3})", m.AccessLevel, CommandLogging.Format(m), index, toAll);

            Packet p = new PlaySound(index, m.Location);

            p.Acquire();

            foreach (NetState state in m.GetClientsInRange(12))
            {
                if (toAll || state.Mobile.CanSee(m))
                {
                    state.Send(p);
                }
            }

            p.Release();
        }
 // Start is called before the first frame update
 void Start()
 {
     OnBreak   = true;
     nav       = GetComponent <NavigateTo>();
     control   = GameObject.Find("Control").GetComponent <GameControl>();
     playsound = GetComponent <PlaySound>();
 }
Example #6
0
    // Update is called once per frame
    void Update()
    {
        waitTime -= Time.deltaTime;
        if (waitTime <= 0)
        {
            gameObject.tag = "Murder";
            puppet.SetActive(true);
            if (!playedSnd)
            {
                particles.GetComponent <ParticleSystem>().Stop();
                PlaySound.NoLoopRandomPitch(snd, 0.5f, 1.5f);
                playedSnd = true;
            }
        }
        else
        {
            gameObject.tag = "Untagged";
            puppet.SetActive(false);
        }

        if (waitTime <= -0.25f)
        {
            Destroy(gameObject);
        }
    }
Example #7
0
 private void Start()
 {
     player     = GameObject.FindGameObjectWithTag("Player");
     mA         = GetComponent <MeleeAttack>();
     enemyStats = GetComponent <EnemyStats>();
     ps         = GetComponent <PlaySound>();
 }
Example #8
0
    // Update is called once per frame
    void Update()
    {
        if (!got && Game.playerObj != null)
        {
            Vector3 playerPos = Game.playerObj.transform.position;
            EndPointX = playerPos.x;
            EndPointY = playerPos.y;

            BezierTime += Time.deltaTime;

            CurveX = (((1 - BezierTime) * (1 - BezierTime)) * StartPointX) + (2 * BezierTime * (1 - BezierTime) * ControlPointX) + ((BezierTime * BezierTime) * EndPointX);
            CurveY = (((1 - BezierTime) * (1 - BezierTime)) * StartPointY) + (2 * BezierTime * (1 - BezierTime) * ControlPointY) + ((BezierTime * BezierTime) * EndPointY);
            gameObject.transform.position = Vector3.Lerp(gameObject.transform.position, new Vector3(CurveX, CurveY, 0), 7f * Time.deltaTime);

            if (BezierTime >= 1.11f)
            {
                GameObject puppet = transform.Find("puppet").gameObject;
                if (Game.currentLasers < Game.maxLasers)
                {
                    Game.currentLasers++;
                }
                float size = 10f;
                PlaySound.NoLoop(snd);
                iTween.ScaleTo(puppet, new Vector3(size, size / 2f, 1f), 1f);
                iTween.ColorTo(puppet, new Color(puppet.GetComponent <MeshRenderer>().material.color.r, puppet.GetComponent <MeshRenderer>().material.color.g, puppet.GetComponent <MeshRenderer>().material.color.b, 0f), 1f);
                particleObj.GetComponent <ParticleSystem>().Stop();
                got = true;
            }
        }
        else
        {
            Destroy(gameObject, 1f);
        }
    }
Example #9
0
    //public GameObject[] objectList = new GameObject[30];//存储所有障碍物和奖励物品
    //GameObject go;
    //int listLength;

    //private PlayerController player;
    //GameModel gameModel;

    //private int currentscene = 0;

    private void Start()
    {
        //保留当前gameObject
        DontDestroyOnLoad(this.gameObject);

        objectPool = ObjectPool.Instance;
        playSound  = PlaySound.Instance;
        staticData = StaticData.Instance;

        //gameModel = GetModel<GameModel>();

        //注册StartGameController
        RegisterController(Const.E_StartGame, typeof(StartGameController));

        SendEvent(Const.E_StartGame);

        //场景跳转
        Instance.LoadScene(1);
        //player = GameObject.FindWithTag(Tags.player).GetComponent<PlayerController>();
        //Instance.playSound.PlayBgAudio(Const.Bgm_ZhanDou);
        //Instance.playSound.StartStepAudio();

        //foreach (GameObject go in objectList)
        //{
        //    if (go != null)
        //    {
        //        listLength++;
        //    }
        //}
        //Debug.Log(listLength);
    }
Example #10
0
        public override bool OnDragDropInto(Mobile from, Item dropped, Point3D point)
        {
            if (dropped is BasePiece piece && piece.Board == this && base.OnDragDropInto(from, dropped, point))
            {
                Packet p = new PlaySound(0x127, GetWorldLocation());

                p.Acquire();

                if (RootParent == from)
                {
                    from.Send(p);
                }
                else
                {
                    foreach (var state in GetClientsInRange(2))
                    {
                        state.Send(p);
                    }
                }

                p.Release();

                return(true);
            }

            return(false);
        }
Example #11
0
    // Use this for initialization
    void Start()
    {
        hpManager = GameObject.Find("HP").GetComponent <HPManager> ();

        headSound = GameObject.Find("HeadSound").GetComponent <PlaySound> ();
        tailSound = GameObject.Find("TailSound").GetComponent <PlaySound> ();
    }
Example #12
0
 private void Start()
 {
     general  = GetComponent <General>();
     rb       = GetComponent <Rigidbody2D>();
     animator = GetComponent <Animator>();
     ps       = GetComponent <PlaySound>();
 }
Example #13
0
        private void verify_boss_finger()
        {
            pictureBox1.Image = Properties.Resources.f5;
            pictureBox2.Image = Properties.Resources.finger_check;
            message.Visible   = false;
            FingerVerify fv_bossLeader = new FingerVerify("主管领导");

            //验证主管领导指纹
            while (_continue)
            {
                //播放音效
                PlaySound.paly(Properties.Resources._28);
                //如果验证通过
                //if (fv_bossLeader.verifyFinger())
                if (true)
                {
                    result            = true;
                    pictureBox1.Image = Properties.Resources.f9;
                    //语音提示
                    PlaySound.paly(Properties.Resources._7);
                    break;
                }
                else
                {
                    pictureBox1.Image = Properties.Resources.f4;
                    //语音提示
                    PlaySound.paly(Properties.Resources._8);
                }
            }
        }
Example #14
0
        private void verify_gunarkAdmin()
        {
            pictureBox1.Image = Properties.Resources.f7;
            pictureBox2.Image = Properties.Resources.finger_check;
            message.Visible   = false;
            FingerVerify fv_gunarkAdmin = new FingerVerify("枪柜管理员");

            //验证枪柜枪员指纹
            while (_continue)
            {
                //播放音效
                PlaySound.paly(Properties.Resources._26);
                //如果验证通过(假设通过)
                //if (fv_gunarkAdmin.verifyFinger())
                if (true)
                {
                    result            = true;
                    pictureBox1.Image = Properties.Resources.f9;
                    //语音提示
                    PlaySound.paly(Properties.Resources._7);
                    break;
                }
                else
                {
                    pictureBox1.Image = Properties.Resources.f8;
                    //语音提示
                    PlaySound.paly(Properties.Resources._32);
                }
            }
        }
Example #15
0
        private void verify_leader_finger()
        {
            pictureBox1.Image = Properties.Resources.f3;
            pictureBox2.Image = Properties.Resources.finger_check;
            message.Visible   = false;
            FingerVerify fv_dutyLeader = new FingerVerify("当班领导");

            //验证当班领导指纹具体方法
            while (_continue)
            {
                //语音提示
                PlaySound.paly(Properties.Resources._5);
                //验证指纹
                //if (fv_dutyLeader.verifyFinger())
                if (true)
                {
                    pictureBox1.Image = Properties.Resources.f9;
                    result            = true;
                    //语音提示
                    PlaySound.paly(Properties.Resources._7);
                    break;
                }
                else
                {
                    pictureBox1.Image = Properties.Resources.f6;
                    //语音提示
                    PlaySound.paly(Properties.Resources._34);
                }
            }
        }
Example #16
0
        private void verify_alcohol()
        {
            pictureBox1.Image = Properties.Resources.a1;
            pictureBox2.Image = Properties.Resources.alcoholpic0;
            message.Visible   = false;
            AlcoholVerify av = new AlcoholVerify();

            while (_continue)
            {
                //播放音效
                PlaySound.paly(Properties.Resources._1);
                //if(av.verifyAlcohol())
                if (true /*假设已通过检测*/)
                {
                    pictureBox1.Image = Properties.Resources.a2;
                    pictureBox2.Image = Properties.Resources.alcoholpic1;
                    //播放音效
                    PlaySound.paly(Properties.Resources._2);
                    break;
                }
                else
                {
                    pictureBox1.Image = Properties.Resources.a3;
                    //播放音效
                    PlaySound.paly(Properties.Resources._3);
                }
            }
        }
Example #17
0
        private void verify_police_finger()
        {
            pictureBox1.Image = Properties.Resources.f1;
            pictureBox2.Image = Properties.Resources.finger_check;
            message.Visible   = false;
            FingerVerify fv_police = new FingerVerify("用枪警员");

            while (_continue)
            {
                //播放音效
                PlaySound.paly(Properties.Resources._4);
                //验证指纹
                //如果验证通过
                //if (fv_police.verifyFinger())
                if (true)
                {
                    pictureBox1.Image = Properties.Resources.f9;
                    //语音提示
                    PlaySound.paly(Properties.Resources._7);
                    break;
                }
                else
                {
                    pictureBox1.Image = Properties.Resources.f2;
                    //语音提示
                    PlaySound.paly(Properties.Resources._33);
                }
            }
        }
Example #18
0
 private void OnTriggerEnter2D(Collider2D bullet)
 {
     if (bullet.gameObject.tag == "Bullet")
     {
         if (health > 1)
         {
             health--;
             PlaySound.Damage();
             hitCounter = hitTime;
         }
         else
         {
             PlaySound.NoLoop(breakSnd);
             Instantiate(crystalBreak, transform.position, Quaternion.identity);
             crystalCrack.SetActive(false);
             crystal.SetActive(false);
             GetComponent <PolygonCollider2D>().enabled = false;
             ignite.GetComponent <ParticleSystem>().Play();
             AudioSource litSound = gameObject.AddComponent <AudioSource>();
             litSound.clip         = litSnd;
             litSound.volume       = Game.soundVolume;
             litSound.loop         = false;
             litSound.spatialBlend = 0f;
             litSound.Play();
             puppet.GetComponent <AnimationScript>().enabled = true;
             activated = true;
         }
     }
 }
Example #19
0
    // Update is called once per frame
    void LateUpdate()
    {
        Realtime = Time.timeSinceLevelLoad;



        if (GameObject.FindGameObjectWithTag("Rep") != null && GameObject.FindGameObjectWithTag("Rep").GetComponent <Image>().fillAmount <= 0f)
        {
            Lose();
        }
        if (Song.time >= Song.clip.length)
        {
            Win();
        }

        if (Song.time > HitTimes[Index] && Index < HitTimes.Count - 1)
        {
            generator.NextNote();
            Target = generator.Slimes.Find(Slime => Slime != null && Slime.tag == Notes.Notes[Index].tag);
            if (Target == null)
            {
                return;
            }
            PlaySound TargetSlime = Target.GetComponent <PlaySound>();
            Index++;
            Notes.Cursor         = Index;
            TargetSlime.EndTime  = HitTimes[Index];
            TargetSlime.Duration = HitTimes[Index] - Song.time;
            TargetSlime.Penalty  = Penalty;
            TargetSlime.StartCoroutine(TargetSlime.Timer());
        }
    }
    //Writing out the text.
    IEnumerator TypeText()
    {
        foreach (char letter in text.ToCharArray())
        {
            yield return(new WaitForSeconds(letterPause));

            textBeingWritten += letter;

            if (letter != ' ')
            {
                if (!Game.tootMode)
                {
                    PlaySound.NoLoop(snd);
                }
            }

            if (text != null)
            {
                //Text should equal the text being written out in the coroutine.
                textObj.GetComponent <TextMesh>().text = textBeingWritten;
            }

            yield return(0);

            yield return(new WaitForSeconds(letterPause));
        }
    }
Example #21
0
    void Sound()
    {
        GameObject powerups    = GameObject.Find("PowerUps");
        PlaySound  soundScript = powerups.GetComponent <PlaySound> ();

        soundScript.Play();
    }
Example #22
0
    void Shoot()
    {
        if (shootCounter <= 0 && startCounter <= 0.65f)
        {
            Game.newShotCount++;
            PlaySound.NoLoop(shoot);
            //How many bullets and where they come from based on your shot split rank.
            switch (Game.shotSplitRank)
            {
            case 0:
                GameObject bulletInst = Instantiate(bullet, p0.transform.position, p0.transform.rotation) as GameObject;
                bulletInst.transform.parent = Game.bulletHolder.transform;
                break;

            case 1:
                GameObject bulletInst1 = Instantiate(bullet, p1.transform.position, p1.transform.rotation) as GameObject;
                GameObject bulletInst2 = Instantiate(bullet, p2.transform.position, p2.transform.rotation) as GameObject;
                bulletInst1.transform.parent = Game.bulletHolder.transform;
                bulletInst2.transform.parent = Game.bulletHolder.transform;
                break;

            case 2:
                GameObject bulletInst3 = Instantiate(bullet, p0.transform.position, p0.transform.rotation) as GameObject;
                GameObject bulletInst4 = Instantiate(bullet, p1.transform.position, p1.transform.rotation) as GameObject;
                GameObject bulletInst5 = Instantiate(bullet, p2.transform.position, p2.transform.rotation) as GameObject;
                bulletInst3.transform.parent = Game.bulletHolder.transform;
                bulletInst4.transform.parent = Game.bulletHolder.transform;
                bulletInst5.transform.parent = Game.bulletHolder.transform;
                break;
            }
            shootCounter = shootTime;
        }
    }
Example #23
0
        public override bool OnDragDropInto(Mobile from, Item dropped, Point3D point)
        {
            BasePiece piece = dropped as BasePiece;

            if (piece != null && piece.Board == this && base.OnDragDropInto(from, dropped, point))
            {
                Packet p = new PlaySound(0x127, GetWorldLocation());

                if (RootParent == from)
                {
                    from.Send(p);
                }
                else
                {
                    p.SetStatic();
                    foreach (NetState state in this.GetClientsInRange(2))
                    {
                        state.Send(p);
                    }
                    p.Release();
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #24
0
        public void TestPlaySound(ushort soundID, int x, int y, int z)
        {
            var p = new Point3D(x, y, z);

            var data = new PlaySound(soundID, p).Compile();

            Span <byte> expectedData = stackalloc byte[12];
            var         pos          = 0;

            expectedData.Write(ref pos, (byte)0x54); // Packet ID
            expectedData.Write(ref pos, (byte)1);    // Flags
            expectedData.Write(ref pos, soundID);

#if NO_LOCAL_INIT
            expectedData.Write(ref pos, (ushort)0); // Volume
#else
            pos += 2;
#endif

            expectedData.Write(ref pos, (ushort)p.X);
            expectedData.Write(ref pos, (ushort)p.Y);
            expectedData.Write(ref pos, (short)p.Z);


            AssertThat.Equal(data, expectedData);
        }
Example #25
0
 void OnTriggerEnter2D(Collider2D bullet)
 {
     if (bullet.gameObject.tag == "Bullet" && !dead)
     {
         if (health <= 0)
         {
             PlaySound.NoLoop(exploSnd);
             Instantiate(explosionParticles, gameObject.transform.position, gameObject.transform.rotation);
             for (int i = 0; i < puppets.Count; i++)
             {
                 iTween.ScaleTo(puppets[i], iTween.Hash(
                                    "x", 0, "y", 0, "z", 0,
                                    "time", deathTime - 0.1f,
                                    "looptype", iTween.LoopType.none,
                                    "easetype", iTween.EaseType.easeInOutSine
                                    ));
             }
             iTween.ScaleTo(reticle, iTween.Hash(
                                "y", 0f,
                                "time", deathTime - 0.1f,
                                "looptype", iTween.LoopType.none,
                                "easetype", iTween.EaseType.easeInOutSine
                                ));
             GetComponent <Collider2D>().enabled = false;
             Destroy(gameObject, deathTime);
             dead = true;
         }
         else
         {
             PlaySound.Damage();
             health--;
             hitCounter = hitTime;
         }
     }
 }
Example #26
0
        /// <summary>
        /// We enter this method when we click on the asteroid icon
        /// Check rigth or left button on the mouse is click and make some logic
        /// </summary>
        private void Asteroid_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right) // Rocket
            {
                if (Rocket.Count > 0 && !Rocket.IsFired && StartGame.IsStarted)
                {
                    Rocket.Count--;
                    RocketCount(Rocket.Count);
                    PlaySound.PlayMouseSound(e.Button);
                    Rocket.Fire(RocketPB, Height, BombPB.Left + BombPB.Width / 4);
                }
            }
            else
            {
                if (StartGame.IsStarted)
                {
                    PlaySound.PlayMouseSound(e.Button);
                    Bomb.Life--;
                    Laser.LightUp(LaserPB, e.X, BombPB, true);
                }
            }

            if (Bomb.IsExploding || Bomb.Life <= 0)
            {
                DestroyBomb();
            }
        }
Example #27
0
    void OnCollisionEnter(Collision other)
    {
        if (GetComponent <ShieldUser>().shielded == true)        //&& other.transform.root.tag == "Obstacle")
        {
            GameObject boom = Instantiate(GetComponent <ShieldUser> ().explodeParticle, other.contacts [0].point + Vector3.up * rb.velocity.y / 5, Quaternion.identity) as GameObject;
            Destroy(other.transform.root.gameObject);
            GetComponent <ShieldUser>().shielded = false;
            GetComponent <ShieldUser>().SetShieldedProfile(false);

            //rb.velocity = Vector3.zero;
            //rb.AddForce (Vector3.down * 10, ForceMode.Impulse);
            rb.velocity = Vector3.up * mostRecentSpeed * 0.75f;

            if (PlaySound.myAS != null)
            {
                PlaySound.SetPitch(0.5f);
                PlaySound.Play();
            }
        }
        else
        {
            if (PlaySound.myAS != null)
            {
                PlaySound.SetPitch(1f);
                PlaySound.Play();
            }
            Time.timeScale = 1;
            SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
        }
    }
Example #28
0
    private void DoPlaySound(PlaySound playSound)
    {
        Texture[] sndIconArray  = ScriptResManager.Instance.GetSndIconArray();
        string[]  sndAliasArray = ScriptResManager.Instance.GetSndAliasArray();
        int       num           = sndAliasArray.Length;
        Rect      rect          = new Rect(0f, 0f, 48f, (float)(num * 48));
        Rect      position      = new Rect(size.x / 2f + 4f, 112f, size.x / 2f - 8f, 192f);

        spSound         = GUI.BeginScrollView(position, spSound, rect);
        playSound.Index = GUI.SelectionGrid(rect, playSound.Index, sndIconArray, 1);
        Color   color  = GUI.color;
        Vector2 vector = new Vector2(52f, 0f);

        for (int i = 0; i < sndAliasArray.Length; i++)
        {
            if (i == playSound.Index)
            {
                GUI.color = new Color(0.83f, 0.49f, 0.29f);
            }
            else
            {
                GUI.color = Color.white;
            }
            GUI.Label(new Rect(vector.x, vector.y, size.x / 2f - 60f, 48f), sndAliasArray[i], "MiniLabel");
            vector.y += 48f;
        }
        GUI.color = color;
        GUI.EndScrollView();
    }
Example #29
0
 private void verify_message()
 {
     pictureBox1.Image = Properties.Resources.m3;
     pictureBox2.Image = Properties.Resources.messagepic0;
     message.Visible   = true;
     //调用接口发送短信
     //SendMessage.send(user_bll.GetModel(task_info.TASK_APPROVAL_USERID).USER_MOBILTELEP, user_bll.GetModel(task_info.TASK_APPLY_USERID).USER_REALNAME);
     //验证短信
     while (_continue)
     {
         PlaySound.paly(Properties.Resources._24);
         //if (CheckMessage.check(message.Text.Trim()))
         if (true)
         {
             pictureBox1.Image = Properties.Resources.m2;
             pictureBox2.Image = Properties.Resources.messagepic;
             PlaySound.paly(Properties.Resources._25);
             break;
         }
         else
         {
             pictureBox1.Image = Properties.Resources.m1;
             PlaySound.paly(Properties.Resources._35);
         }
         System.Threading.Thread.Sleep(2000);
     }
 }
    void Update()
    {
        RaycastHit hit;

        Physics.Raycast(mainCamera.transform.position, mainCamera.transform.forward, out hit);
        PlaySound focus = hit.collider ? hit.collider.GetComponent <PlaySound>() : null;

        int numSources = sources.Length;

        for (int sourceIndex = 0; sourceIndex < numSources; ++sourceIndex)
        {
            PlaySound source = sources[sourceIndex];
            if (source)
            {
                if (source.pedestal)
                {
                    source.pedestal.material.SetColor("_Color", source == focus ? new Color(3, 3, 3) : Color.white);
                }
                if (source.source)
                {
                    source.sound.transform.position = source.source.transform.position;
                    int numMaterials = source.source.materials.Length;
                    for (int materialIndex = 0; materialIndex < numMaterials; ++materialIndex)
                    {
                        source.source.materials[materialIndex].SetColor("_Color", source.sound.isPlaying ? new Color(3, 3, 3) : Color.white);
                    }
                }
            }
        }

        if (Cardboard.SDK.Triggered)
        {
            if (focus)
            {
                if (focus.sound.isPlaying)
                {
                    focus.sound.Stop();
                }
                else
                {
                    focus.sound.Play();
                }
            }
            else
            {
                // Change environment
                currentEnvIndex = (currentEnvIndex + 1) % environments.Length;
                for (int i = 0; i < environments.Length; i++)
                {
                    environments[i].SetActive(i == currentEnvIndex);
                }
                UpdateReferences();
            }
        }

        if (Cardboard.SDK.BackButtonPressed)
        {
            Application.Quit();
        }
    }
Example #31
0
 void Start()
 {
     if (curSprite == 0) {
         curSprite = Random.Range(-3, 4);
         if (curSprite > 0) {
             curUp = false;
         }
     }
     InvokeRepeating("ChangeFire", 0, 0.25f);
     spriteRenderer = GetComponent<SpriteRenderer>();
     theCollider = GetComponent<BoxCollider2D>();
     playSound = GetComponent<PlaySound>();
 }
 private void btnPlaySound_Click(object sender, RoutedEventArgs e)
 {
     var sound = Sound.NewSound(false);
     var action = new PlaySound(_defaultEventType, _sourceObjectId, sound.ObjectId);
     
     var mainWin = DesignerMainWindow.GetInstance();
     var currentSlideNr = mainWin.GetCurrentSlideNr();
     mainWin.canMainCanvas.AddIObject(sound);
     mainWin.canMainCanvas.SaveAllSlideData(Practice.GetInstance().GetSlideByPosition(currentSlideNr));
     
     Act = action;
     DialogResult = true;
     Close();
 }
        private void CreatePhotoalbumSlide(Picture pic, Sound sound, Text text)
        {
            InkCanvas canvas = DesignerMainWindow.GetInstance().canMainCanvas;

            ObjectPositionOnSlide.ApplyCenterPictureModifications(pic, canvas);
            ObjectPositionOnSlide.ApplyTextModifications(text, canvas);
            pic.SlideId = sound.SlideId = text.SlideId = SlideId;

            var psAction = new PlaySound(EventType.onClick, text.ObjectId, sound.ObjectId);
            text.Actions.Add(psAction);
            psAction = new PlaySound(EventType.onClick, pic.ObjectId, sound.ObjectId);
            pic.Actions.Add(psAction);

            SlideObjects.Add(pic);
            SlideObjects.Add(text);
            SlideObjects.Add(sound);
        }
Example #34
0
 void Start()
 {
     spriteRenderer = GetComponent<SpriteRenderer>();
     if (spriteRenderer == null) {
         spriteRenderer = GetComponentInChildren<SpriteRenderer>();
     }
     if (tag == "Player") {
         hpbar = GameObject.Find("HP").GetComponent<HPbar>();
     }
     playSound = GetComponent<PlaySound>();
 }
Example #35
0
 void Start()
 {
     playSound = GetComponent<PlaySound>();
 }
Example #36
0
        private ComAction LoadPlaySound(IEnumerable<XAttribute> attributes)
        {
            PlaySound action = new PlaySound();
            action.Type = ActionType.playSound;

            foreach (var attr in attributes)
            {
                switch (attr.Name.ToString())
                {
                    case "targetObjectID":
                        action.TargetObjectId = Int32.Parse(attr.Value);
                        break;
                    default:
                        break;
                }
            }

            return action;
        }
Example #37
0
 void Start()
 {
     player = GameObject.FindWithTag("Player").transform;
     playSound = GetComponent<PlaySound>();
 }