コード例 #1
0
ファイル: ProjectileVolley.cs プロジェクト: Sogekeeper/ZODZ3
    private void CastProjectile(PoolObject projectile, SkillUser user, bool rotateProjectile = true)
    {
        PoolObject p = user.userPool.SpawnTargetObject(projectile, 10);

        if (soundOnCastEach)
        {
            EazySoundManager.PlaySound(soundOnCastEach, 0.1f);
        }
        if (user.skillSpawnPoint)
        {
            p.transform.position = user.skillSpawnPoint.position;
        }
        else
        {
            p.transform.position = user.transform.position;
        }
        //p.transform.position += user.userAim.aimDirection.normalized * spawnDistanceMultiplier;
        if (rotateProjectile)
        {
            user.userAim.RotateObjectToAim(p.transform);
        }
        p.GetComponent <ProjectileObject>().InitializeProjectile(user);
        if (castingKnockback > 0)
        {
            user.userStats.rb.velocity = Vector3.zero;
            Vector3 kDirection = user.userAim.aimDirection.normalized;
            if (!forwardCastingKnockback)
            {
                kDirection.y *= -1; kDirection.x *= -1; //eu sei que dava pra fazer numa conta só, mas só assim vai
            }
            user.userStats.rb.AddForce(kDirection * castingKnockback);
        }
    }
コード例 #2
0
 private void ActivateSounds()
 {
     EazySoundManager.PlaySound(sound, 2.0f);
     musicManager.Music = music;
     musicManager.PlayMusic();
     musicManager.IsLocked = true;
 }
コード例 #3
0
    public void PlaySound2()
    {
        EazySoundDemoAudioControls audioControl = AudioControls[3];
        int audioID = EazySoundManager.PlaySound(audioControl.audioclip, audioControl.volumeSlider.value);

        AudioControls[3].audio = EazySoundManager.GetAudio(audioID);
    }
コード例 #4
0
    /// <summary>
    /// 切换到死亡状态
    /// </summary>

    public void ToDead()
    {
        StopAllCoroutines();
        Status = RoleStatus.Dead;
        m_Rigidbody.velocity    = Vector3.down * 5;
        m_Rigidbody.isKinematic = false;
        m_Rigidbody.useGravity  = true;
        Destroy(m_Shadow.gameObject);
        if (m_CurPlatform != null)
        {
            if (m_CurPlatform.PlatfromType == PlatfromType.OtherTrap || m_CurPlatform.PlatfromType == PlatfromType.HideTrap)
            {
                GameObject go = Instantiate(m_DeadEffect);
                go.transform.position = transform.position;
                go.transform.rotation = Quaternion.identity;
                Destroy(go, 5);
                EazySoundManager.PlaySound(m_DeadAudioClip);
            }
        }


        if (OnDead != null)
        {
            OnDead(this);
        }
    }
コード例 #5
0
 public void PlayKnockoutSound()
 {
     if (punchSound)
     {
         EazySoundManager.PlaySound(punchSound);
     }
 }
コード例 #6
0
        /// <summary>
        /// 无效点操作
        /// </summary>
        private void OnInvalidPoint(bool isError = false)
        {
            if (m_Line == null)
            {
                return;
            }
            Ray          ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit2D hit = Physics2D.Raycast(ray.origin, Vector2.up, 0.05f);

            if (hit.collider != null)
            {
                m_Line.UpdateLine(hit.point);
                if (m_LastErrorObj != null && m_LastErrorObj != hit.collider.gameObject)
                {
                    if (isError)
                    {
                        EazySoundManager.PlaySound(ClickError);
                        OnValidLineCountChange(0);
                    }
                    else
                    {
                        if (m_ChainInfo.CheckIsLastOne(hit.collider.gameObject))
                        {
                            OnValidLineCountChange(m_ChainInfo.ValidLineCount);
                        }
                    }
                }
                m_LastErrorObj = hit.collider.gameObject;
            }
        }
コード例 #7
0
 private void OnCollisionEnter2D(Collision2D collision)
 {
     EazySoundManager.PlaySound(sound, 2.0f);
     collectItemsCondition.AddItem();
     collectItemsCondition.CheckVictory();
     Destroy(gameObject);
 }
コード例 #8
0
        public void ToAttack()
        {
            EazySoundManager.PlaySound(AtkClip);
            m_Aniamtor.SetTrigger("ToAtk");
            switch (m_Dirction)
            {
            case Dirction.Left:
                m_Aniamtor.SetInteger("AtkType", 0);
                break;

            case Dirction.LeftUp:
                m_Aniamtor.SetInteger("AtkType", 1);
                break;

            case Dirction.RightUp:
                m_Aniamtor.SetInteger("AtkType", 2);
                break;

            case Dirction.Right:
                m_Aniamtor.SetInteger("AtkType", 3);
                break;

            case Dirction.RightDown:
                m_Aniamtor.SetInteger("AtkType", 4);
                break;

            case Dirction.LeftDown:
                m_Aniamtor.SetInteger("AtkType", 5);
                break;

            default:
                break;
            }
        }
コード例 #9
0
    /// <summary>
    /// 切换到跳跃状态
    /// </summary>
    /// <param name="dir"></param>
    public void ToJump(JumpDir dir)
    {
        m_JumpDir = dir;
        if (dir == JumpDir.Left)
        {
            m_NextPlatform       = (Platform)m_CurPlatform.LNode;
            m_BodyRenderer.flipX = true;
        }
        else
        {
            m_NextPlatform       = (Platform)m_CurPlatform.RNode;
            m_BodyRenderer.flipX = false;
        }
        m_Animator.SetTrigger("IsJump");
        float x = LocalJumpSecondPos.x;

        if (m_NextPlatform == null || m_CurPlatform.PlatfromType == PlatfromType.Hide)
        {
            x = LocalJumpFirstPos.x;
        }
        else
        {
            if (m_NextPlatform.PlatfromType == PlatfromType.HideTrap || m_NextPlatform.PlatfromType == PlatfromType.OtherTrap)
            {
                //撞到障碍物
                x = LocalJumpFirstPos.x;
            }
            EazySoundManager.PlaySound(m_JumpAudioClip);
        }
        JumpState(x);
    }
コード例 #10
0
ファイル: EntityStats.cs プロジェクト: Reraduragon/ZODZ3
 protected virtual void Die()
 {
     OnDeath?.Invoke();
     if (deathSound)
     {
         EazySoundManager.PlaySound(deathSound, 0.4f);
     }
 }
コード例 #11
0
        /// <summary>
        /// 下
        /// </summary>
        private void CheckBelow()
        {
            bool isGround = false;

            for (int i = 0; i < m_PhyCtroller.BelowHitsStorge.Length; i++)
            {
                if (m_PhyCtroller.BelowHitsStorge[i].distance > 0)
                {
                    //设置地面
                    if (m_PhyCtroller.BelowHitsStorge[i].collider.transform.parent != null)
                    {
                        Floor m_floor = m_PhyCtroller.BelowHitsStorge[i].collider.transform.parent.GetComponent <Floor>();
                        if (m_floor != null)
                        {
                            if (transform.position.y - m_PhyCtroller.BelowHitsStorge[i].point.y > (m_PhyCtroller.GetHeight() / 2 - 0.2f))
                            {
                                if (m_floor != m_CurFloor)
                                {
                                    if (OnRoleJumpToNextFloor != null)
                                    {
                                        OnRoleJumpToNextFloor();
                                    }
                                }
                                if (!Animator.GetCurrentAnimatorStateInfo(0).IsName("RoleWalk"))
                                {
                                    Animator.SetTrigger("IsWalk");
                                }
                                m_CurFloor = m_floor;
                                CameraCtrl.Instance.SetTarget(m_CurFloor.transform);
                                isGround   = true;
                                IsRigibody = false;
                                m_floor.SetAllPlatformCollider(true);
                            }
                        }
                        else
                        {
                            if (!Animator.GetCurrentAnimatorStateInfo(0).IsName("RoleJump"))
                            {
                                Animator.SetTrigger("IsJump");
                            }
                        }
                    }
                    //击破弱点
                    ITopWeakness weakness = m_PhyCtroller.BelowHitsStorge[i].collider.GetComponent <ITopWeakness>();
                    if (weakness != null)
                    {
                        Jump(m_BottomAttackImpuse);
                        if (m_BottomAttackClip != null)
                        {
                            EazySoundManager.PlaySound(m_BottomAttackClip);
                        }
                        weakness.Break();
                        return;
                    }
                }
            }
            IsGround = isGround;
        }
コード例 #12
0
        private void PointDown()
        {
            m_ChainInfo.StartStronghold = null;
            m_ChainInfo.EndStronghold   = null;
            if (m_ChainInfo.LineList == null)
            {
                m_ChainInfo.LineList = new List <Line>();
            }
            m_ChainInfo.LineList.Clear();
            //第一个点
            m_Line       = null;
            m_LineOrigin = null;
            Cell c = GetCell(Input.mousePosition);

            if (c != null)
            {
                Stronghold s = c.GetStronghold();
                if (s != null)
                {
                    if (!s.HasConnectStronghold())
                    {
                        bool isOk = true;
                        if (GameLevelSceneCtrl.Instance.IsGuide)
                        {
                            if (GameLevelSceneCtrl.Instance.ContainsGuideObj(c.gameObject))
                            {
                                isOk = true;
                            }
                            else
                            {
                                isOk = false;
                            }
                        }
                        if (isOk)
                        {
                            GameObject go = ResourcesMrg.Instance.Load(ResourcesMrg.ResourceType.Item, "Building/Line", isCache: true, isClone: true);
                            m_Line = go.GetComponent <Line>();
                            m_Line.AddCell(c);
                            m_LineOrigin  = c;
                            m_Line.Parent = null;
                            m_ChainInfo.Start(s, OnValidLineCountChange);
                            m_ChainInfo.AddLine(m_Line);
                            EazySoundManager.PlaySound(ClickStronghold);
                        }
                    }
                    else
                    {
                        ChainInfo info = m_AllChainInfo.Find(x => x.StartStronghold == s || x.EndStronghold == s);
                        if (!info.IsEmpty())
                        {
                            m_AllChainInfo.Remove(info);
                            info.Destory();
                        }
                    }
                }
            }
        }
コード例 #13
0
    private void Awake()
    {
        trans       = GetComponent <Transform>();
        skillUser   = playerMovement.GetComponent <SkillUser>();
        playerStats = playerMovement.GetComponent <PlayerStats>();
        int curID = EazySoundManager.PlaySound(singleAudio, baseVolume, true, null);

        currentAudio = EazySoundManager.GetAudio(curID);
    }
コード例 #14
0
        private void OnTriggerEnter2D(Collider2D collision)
        {
            RoleCtrl ctrl = collision.GetComponent <RoleCtrl>();

            if (ctrl != null)
            {
                ctrl.AddHp();
                Destroy(this.gameObject);
                EazySoundManager.PlaySound(Clip);
            }
        }
コード例 #15
0
ファイル: EazySoundPlayer.cs プロジェクト: Sogekeeper/ZODZ3
 public void PlayThisSound()
 {
     if (isUI)
     {
         EazySoundManager.PlayUISound(targetAudio, baseVolume);
     }
     else
     {
         EazySoundManager.PlaySound(targetAudio, baseVolume);
     }
 }
コード例 #16
0
    public void PlaySound(AudioTag audioTag)
    {
        if (EazySoundManager.GetAudio(dict_AudioClips[audioTag]) == null)
        {
            EazySoundManager.PlaySound(dict_AudioClips[audioTag], sound_Volume);
        }

        else if (!EazySoundManager.GetAudio(dict_AudioClips[audioTag]).IsPlaying)
        {
            EazySoundManager.PlaySound(dict_AudioClips[audioTag], sound_Volume);
        }
    }
コード例 #17
0
        // Use this for initialization
        IEnumerator Start()
        {
            if (DelegateDefine.Instance.OnGetCoin != null)
            {
                DelegateDefine.Instance.OnGetCoin();
            }
            EazySoundManager.PlaySound(m_GetCoinClip);
            m_Renderer = GetComponentInChildren <SpriteRenderer>();
            yield return(new WaitForSeconds(m_DestoryDelay));

            Destroy(this.gameObject);
        }
コード例 #18
0
 public bool Break()
 {
     if (m_BreakClip != null)
     {
         EazySoundManager.PlaySound(m_BreakClip);
     }
     Destroy(this.gameObject);
     m_PlatformStatus = PlatformStatus.Break;
     //m_TriggerCollider.enabled = false;
     GetComponentInChildren <SpriteRenderer>().enabled = false;
     return(GetComponentInChildren <SpriteRenderer>().enabled);
 }
コード例 #19
0
ファイル: CoinItem.cs プロジェクト: Sogekeeper/ZODZ3
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.GetComponent <PlayerStats>())
     {
         if (pickupSound)
         {
             EazySoundManager.PlaySound(pickupSound);
         }
         playerCharacterSettings.coins++;
         gameObject.SetActive(false);
     }
 }
コード例 #20
0
ファイル: AudioController.cs プロジェクト: Kruemelkatze/Swarm
    public int PlaySound(AudioClip clip, float volume, bool loop = true, float pitch = 1,
                         Transform sourceTransform = null)
    {
        if (!Application.isPlaying)
        {
            return(-1);
        }

        var id        = EazySoundManager.PlaySound(clip, volume, loop, sourceTransform);
        var eazyAudio = EazySoundManager.GetSoundAudio(id);

        eazyAudio.Pitch = pitch;

        return(id);
    }
コード例 #21
0
    private void Play(AudioType type, AudioClip clip)
    {
        switch (type)
        {
        case AudioType.MUSIC:
            EazySoundManager.PlayMusic(clip);
            break;

        case AudioType.SOUND:
            EazySoundManager.PlaySound(clip);
            break;

        case AudioType.UISOUND:
            EazySoundManager.PlayUISound(clip);
            break;
        }
    }
コード例 #22
0
        private IEnumerator OnRoleStatusChangeIE(RoleStatus obj)
        {
            if (obj == RoleStatus.Win)
            {
                Debug.Log("失败");
                Monster.OnWin();
                EazySoundManager.PlaySound(FailClip);
                yield return(new WaitForSeconds(1));

                UIViewMgr.Instance.OpenView(UIViewType.Fail);
            }
            else if (obj == RoleStatus.Fail)
            {
                EazySoundManager.PlaySound(WinClip);
                UIViewMgr.Instance.OpenView(UIViewType.Win);
                Debug.Log("胜利");
            }
        }
コード例 #23
0
ファイル: Controller.cs プロジェクト: Hangeris/PhoneSensor
    public void BallCollisionEnter(Color ballColor, AudioClip audioClip, float collisionForce)
    {
        if (UIController.IsVibrationActive)
        {
            vibrationSensor.Vibrate();
        }

        if (UIController.IsBlinkEffectActive)
        {
            blinkEffect.Blink(ballColor);
        }

        if (UIController.IsSoundActive)
        {
            var volume = audioVolumeCurve.Evaluate(collisionForce);
            EazySoundManager.PlaySound(audioClip, volume);
        }
    }
コード例 #24
0
 protected override void OnUpdate()
 {
     base.OnUpdate();
     if (GameLevelStatus == GameLevelStatus.Playing)
     {
         if (m_IsPlayerRound)
         {
             if (Faction1.IsRound)
             {
                 if (Input.GetMouseButtonDown(0))
                 {
                     Ray          ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                     RaycastHit2D hit = Physics2D.Raycast(ray.origin, Vector2.up, 0.05f);
                     if (hit.collider == null)
                     {
                         return;
                     }
                     Node n       = GridManager.Instance.GetNodeByPos(hit.collider.transform.position);
                     bool inRange = Player.CheckTargetInRange(n);
                     if (inRange)
                     {
                         Faction1.RoundStart();
                         Faction2.RoundStart();
                         Faction1.Action(hit.collider.transform.position);
                     }
                     else
                     {
                         //播放点击错误声音
                         EazySoundManager.PlaySound(ErrorClip);
                     }
                 }
             }
         }
         else
         {
             if (Faction2.IsRound)
             {
                 Faction2.Action(Player.transform.position);
             }
         }
     }
 }
コード例 #25
0
ファイル: EntityStats.cs プロジェクト: Reraduragon/ZODZ3
 private void ComputateDamage(int damage)
 {
     if (currentLife <= 0)
     {
         return;
     }
     if (takeDamageSound)
     {
         EazySoundManager.PlaySound(takeDamageSound, 0.2f);
     }
     OnTakeDamage?.Invoke(damage);
     currentLife -= damage;
     StartDownTime();
     rb.velocity = Vector3.zero;
     if (currentLife <= 0)
     {
         currentLife = 0;
         Die();
     }
 }
コード例 #26
0
 public void UpdateCurrentOptionIndex(float y)
 {
     EazySoundManager.PlaySound(moveSound, 2.0f);
     if (y > 0)
     {
         currentOptionIndex -= 1;
         if (currentOptionIndex < 0)
         {
             currentOptionIndex = menuOptionsList[currentMenuStep].menuOptions.Count - 1;
         }
     }
     else if (y < 0)
     {
         currentOptionIndex += 1;
         if (currentOptionIndex >= menuOptionsList[currentMenuStep].menuOptions.Count)
         {
             currentOptionIndex = 0;
         }
     }
     UpdateColor();
 }
コード例 #27
0
        /// <summary>
        /// 上
        /// </summary>
        private void CheckAbove()
        {
            for (int i = 0; i < m_PhyCtroller.AboveHitsStorge.Length; i++)
            {
                if (m_PhyCtroller.AboveHitsStorge[i].distance > 0)
                {
                    //地面不做判断
                    if (IsGround)
                    {
                        return;
                    }
                    IBottomWeakness weakness = m_PhyCtroller.AboveHitsStorge[i].collider.GetComponent <IBottomWeakness>();
                    if (weakness != null)
                    {
                        Rigidbody.velocity = new Vector2(HorizontalVelocity, 0);
                        Rigidbody.AddForce(new Vector2(0, m_TopAttackImpuse), ForceMode2D.Impulse);
                        IsRigibody = true;
                        weakness.Break();
                        Platform p = weakness as Platform;
                        if (p != null)
                        {
                            if (m_TopAttackFloorClip != null)
                            {
                                EazySoundManager.PlaySound(m_TopAttackFloorClip);
                            }
                        }
                        else
                        {
                            if (m_TopAttackOtherClip != null)
                            {
                                EazySoundManager.PlaySound(m_TopAttackOtherClip);
                            }
                        }

                        return;
                    }
                }
            }
        }
コード例 #28
0
        private void OnTriggerEnter2D(Collider2D collision)
        {
            Wall wall = collision.GetComponent <Wall>();

            if (wall != null)
            {
                //m_Timer = Random.Range(0, m_IdleTime);
                m_IsMove = false;
            }
            if (m_TriggerRole)
            {
                RoleCtrl ctrl = collision.GetComponent <RoleCtrl>();
                if (ctrl != null)
                {
                    if (DelegateDefine.Instance.OnGetCoin != null)
                    {
                        DelegateDefine.Instance.OnGetCoin();
                    }
                }
                EazySoundManager.PlaySound(m_GetCoinClip);
                Destroy(this.gameObject);
            }
        }
コード例 #29
0
        private bool OnWin()
        {
            int level = Global.Instance.CurLevel;

            level++;
            int maxLevel = GameLevelDBModel.Instance.GetLevelCount();

            if (level > maxLevel)
            {
                return(true);
            }
            if (level >= maxLevel)
            {
                maxLevel = level;
            }
            Global.Instance.CurLevel = level;
            if (Global.Instance.CurLevel >= Global.Instance.MaxPassLevel)
            {
                Global.Instance.MaxPassLevel = Global.Instance.CurLevel;
            }
            EazySoundManager.PlaySound(WinClip);
            return(false);
        }
コード例 #30
0
    public void SelectNextSkill(bool forward = true)
    {
        int lastIndex = selectedSkillIndex;

        if (forward)
        {
            selectedSkillIndex = (selectedSkillIndex + 1) % astralMapFiltered.Count;
        }
        else
        {
            selectedSkillIndex--;
            if (selectedSkillIndex < 0)
            {
                selectedSkillIndex = astralMapFiltered.Count - 1;
            }
        }
        if (selectedSkillIndex != lastIndex && skillSwitchSound)
        {
            EazySoundManager.PlaySound(skillSwitchSound);
        }
        selectedMagicSkill = astralMapFiltered[selectedSkillIndex].magicSkill;
        OnSkillSwaped?.Invoke();
    }