GetSwitch() публичный статический Метод

public static GetSwitch ( string in_pstrSwitchGroupName, UnityEngine in_GameObj, uint &out_rSwitchState ) : AKRESULT
in_pstrSwitchGroupName string
in_GameObj UnityEngine
out_rSwitchState uint
Результат AKRESULT
Пример #1
0
    void OnCollisionEnter(Collision col)
    {
        if (playerWeapon)
        {
            if (equipped && col.gameObject.tag != "Player")
            {
                Vector3 playerToHitPoint = col.contacts[0].point - PlayerManager.Instance.player.transform.position;
                Attack  attack           = new Attack(BaseDamage, playerToHitPoint, knockbackStrength, SwingTypes.None, weaponType, col.contacts[0].point);

                AnimatorStateInfo currentAnimation = PlayerManager.Instance.playerAnimator.GetCurrentAnimatorStateInfo(0);
                if (currentAnimation.IsName("Player_RightSwing"))
                {
                    attack.swingType = SwingTypes.Right;
                    WeaponCombo1.SetValue();
                }
                else if (currentAnimation.IsName("Player_LeftSwing"))
                {
                    attack.swingType = SwingTypes.Left;
                    WeaponCombo2.SetValue();
                }
                else if (currentAnimation.IsName("Player_TopSwing"))
                {
                    attack.swingType = SwingTypes.Top;
                    WeaponCombo3.SetValue();
                }

                if (!alreadyHitObjects.Contains(col.gameObject))
                {
                    //get material of the contact point
                    SoundMaterial sm = col.gameObject.GetComponent <SoundMaterial>();
                    if (sm != null)
                    {
                        uint thisSwitch = 0;
                        AkSoundEngine.GetSwitch((uint)sm.material.GroupId, transform.parent.gameObject, out thisSwitch);
                        //print("Current Switch: "+ thisSwitch +", New: "+ sm.material.ID);

                        if (thisSwitch != (uint)sm.material.Id)
                        {
                            sm.material.SetValue(transform.parent.gameObject); // Set Impact Material
                                                                               //print("New Impact Material: "+ sm.gameObject.name);
                        }
                    }

                    SetAndPlayWeaponImpact(col.gameObject);
                    GameManager.DamageObject(col.gameObject, attack);

                    GameObject hit = Instantiate(hitEffect, transform.position, Quaternion.identity) as GameObject; //TODO: Pool hit effects
                    Destroy(hit, 5f);

                    if (col.gameObject.layer == LayerMask.NameToLayer("Agent"))
                    {
                        //ComboEvent.Post(transform.parent.gameObject);
                        attack.damage += applyBonusDamage ? comboCompletionBonusDamage : 0;

                        float newTimeScale   = applyBonusDamage ? 0.2f : 0.5f;
                        float transitionTime = 0.1f;
                        float holdTime       = applyBonusDamage ? 0.2f : 0.1f;
                        float shakeDuration  = applyBonusDamage ? 0.3f : 0.15f;
                        float shakeScale     = applyBonusDamage ? 0.2f : 0.1f;

                        GameManager.Instance.gameSpeedHandler.SetGameSpeed(gameObject.GetInstanceID(), newTimeScale, transitionTime, transitionTime, holdTime);
                        PlayerManager.Instance.CamShake(new PlayerCamera.CameraShake(shakeScale, shakeDuration));
                    }
                }
            }
        }
        else
        {
            if (col.gameObject.CompareTag("Player"))
            {
                Attack attack = new Attack(BaseDamage, col.contacts[0].point - PlayerManager.Instance.player.transform.position, BaseDamage);
                GameManager.DamageObject(col.gameObject, attack);
                WeaponTypeSwitch.SetValue(transform.parent.gameObject); // Weapon Type
                WeaponImpact.Post(transform.parent.gameObject);
            }
        }
    }
Пример #2
0
    void PerformAction()
    {
        if (!actionLaunched)
        {
            actionLaunched = true;

            if (actionChoosed.GetTargetType() == ActionType.ActionTargetType.OneTarget)
            {
                uint state;
                AkSoundEngine.GetSwitch("Tension", gameObject, out state);
                if (actionChoosed == ActionType.ATTACK && currentFighter.GetCreatureType() == CreatureType.Human && state != 4)
                {
                    AkSoundEngine.SetSwitch("Tension", "T3", gameObject);
                }

                currentFighter.PerformActionOnTarget(actionChoosed, targetChoosed);
            }
            else if (actionChoosed.GetTargetType() == ActionType.ActionTargetType.AllTarget)
            {
                if (currentFighter.GetCreatureType() == CreatureType.Human)
                {
                    currentFighter.PerformActionOnTarget(actionChoosed, monsterGroupFighter);
                    if (actionChoosed == ActionType.FEAR)
                    {
                        //   AkSoundEngine.SetSwitch("Tension", "T3", gameObject);
                    }
                    else if (actionChoosed == ActionType.TALK)
                    {
                        successfulTalkCount++;
                        if (successfulTalkCount > 1)
                        {
                            AkSoundEngine.SetSwitch("Tension", "T1", gameObject);
                        }
                        AkSoundEngine.PostEvent("Play_HumanTalk", gameObject);
                    }
                }
                else
                {
                    currentFighter.PerformActionOnTarget(actionChoosed, humanGroupFighter);
                    if (actionChoosed == ActionType.FEAR)
                    {
                        AkSoundEngine.PostEvent("Play_" + currentFighter.sName + "Fear", gameObject);
                    }
                    if (actionChoosed == ActionType.TALK)
                    {
                        AkSoundEngine.PostEvent("Play_" + currentFighter.sName + "Talk", gameObject);
                    }
                }
            }
            else if (actionChoosed.GetTargetType() == ActionType.ActionTargetType.NoTarget)
            {
                if (currentFighter.GetCreatureType() == CreatureType.Human)
                {
                    currentFighter.PerformActionOnSelf(actionChoosed, humanGroupFighter);
                }
                else
                {
                    currentFighter.PerformActionOnSelf(actionChoosed, monsterGroupFighter);
                }
            }
        }
        else if (!currentFighter.performingAction)
        {
            if (actionChoosed == ActionType.TALK)
            {
                talkManager.customTalk.talkHasBeenInit = true;
            }

            talkManager.customTalk.combatHasBeenInit = true;

            PutFighterInInitialPosition();
        }


        // Invoke("ActionEnded", 2);
    }