Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            // AUD_Manager.SetSwitch("Voice", "Banter", gameObject);
            // AUD_Manager.PostEvent("VC_ALIENGRUNT_ST", gameObject);

            // Play a different sound as well
            // AUD_Manager.PostEvent("PC_OilSplash_LP_PL", gameObject);
            // AUD_Manager.PostEvent("PC_OilThrow_LP_PL", gameObject);

            if (usesSwitch)
            {
                Debug.Log("Switch Group: " + switchGroup);
                Debug.Log("Switch State: " + switchState);
                AUD_Manager.SetSwitch(switchGroup, switchState, gameObject);
            }

            if (usesSwitch2)
            {
                Debug.Log("Switch Group: " + switchGroup2);
                Debug.Log("Switch State: " + switchState2);
                AUD_Manager.SetSwitch(switchGroup2, switchState2, gameObject);
            }

            AUD_Manager.PostEvent(nameOfEvent, gameObject);
        }
    }
Exemplo n.º 2
0
    public void DeflectPerfeclty(float multiplier)
    {
        // Starts as random
        SetStartingDeflectionState();

        // If the enemy was killed in the process...we try to get another enemy, if it is the last one we make it look like random
        SetTarget(enemyBulletOwner);
        if (target == null)
        {
            AI_Master AI = FindObjectOfType <AI_Master>();
            if (AI != null)
            {
                Transform newEnemy = AI.GetClosestEnemy(transform.position);
                if (newEnemy != null)
                {
                    SetTarget(newEnemy);
                }
            }
        }
        ;

        if (target == null)
        {
            SetRandomDirection();
            Instantiate(particlesWhenBouncedRandomly, transform.position, transform.rotation);
            return;
        }

        SetPerfectDirection(multiplier);
        ChangeColor();
        Instantiate(particlesWhenBouncedPerfectly, transform.position, transform.rotation);
        AUD_Manager.SetSwitch("Parry", "Success", gameObject);
        AUD_Manager.PostEvent("PC_Perry_ST", gameObject);
        bouncedPerfectly = true;
    }
Exemplo n.º 3
0
 public void DeflectRandomly()
 {
     SetStartingDeflectionState();
     SetRandomDirection();
     Instantiate(particlesWhenBouncedRandomly, transform.position, transform.rotation);
     AUD_Manager.SetSwitch("Parry", "Almost", gameObject);
     AUD_Manager.PostEvent("PC_Perry_ST", gameObject);
 }
Exemplo n.º 4
0
    private void Start()
    {
        AUD_Manager.SetSwitch("Objective", mObjectiveState, gameObject);
        AUD_Manager.SetSwitch("ObjectiveProgress", "Low", gameObject);
        AUD_Manager.PostEvent(mGameplayMusicPlay, gameObject);

        mIntensityText.text = "Music Intensity: " + "Low";
    }
Exemplo n.º 5
0
    // This object has a lifetime, so we can rely on that
    private void Start()
    {
        for (int i = 0; i < mSwitchGroups.Length; i++)
        {
            AUD_Manager.SetSwitch(mSwitchGroups[i], mSwitchStates[i], gameObject);
        }

        AUD_Manager.PostEvent(mScream, gameObject);
    }
Exemplo n.º 6
0
    // Update is called once per frame
    private void Start()
    {
        for (int i = 0; i < SwitchGroups.Length; i++)
        {
            AUD_Manager.SetSwitch(SwitchGroups[i], SwitchStates[i], gameObject);
        }

        AUD_Manager.PostEvent(nameOfEvent, gameObject);
    }
Exemplo n.º 7
0
 public void DestroyObject()
 {
     AUD_Manager.SetSwitch("ObjectAction", "Impact", gameObject);
     AUD_Manager.PostEvent(properties.soundEventName, gameObject);
     if (properties.explosionParticlePrefab != null)
     {
         Instantiate(properties.explosionParticlePrefab, transform.position, Quaternion.identity);
     }
     Destroy(gameObject);
 }
Exemplo n.º 8
0
 public void Drop()
 {
     hasBeenThrown    = true;
     transform.parent = null;
     rb.isKinematic   = false;
     SetTransparency(1f);
     gameObject.layer = initialLayer;
     throwHitboxCollider.isTrigger = true;
     throwHitboxCollider.enabled   = true;
     AUD_Manager.SetSwitch("ObjectSize", properties.objSize, gameObject);
     AUD_Manager.PostEvent("PC_ThrowWhooshes_ST_PL", gameObject);
 }
Exemplo n.º 9
0
    public void StopTutorialMusic()
    {
        // AUD_Manager.PostEvent(mGameplayMusicStop, gameObject);
        // AUD_Manager.SetState(mObjectiveSwitch, mFirstObjState);

        // AUD_Manager.PostEvent(mGameplayMusicStop, gameObject);
        AUD_Manager.SetSwitch(mObjectiveSwitch, mFirstObjState, gameObject);

        mIntensityText.text = "Music Intensity: " + mFirstObjState;


        // AUD_Manager.PostEvent(mGameplayMusicPlay, gameObject);
    }
Exemplo n.º 10
0
 private void Update()
 {
     if (Input.GetMouseButtonDown(0))
     {
         Debug.Log("Setting progress music switch: " + mProgressState[index]);
         AUD_Manager.SetSwitch("ObjectiveProgress", mProgressState[index], gameObject);
         index++;
         if (index >= mProgressState.Length)
         {
             index = 0;
         }
     }
 }
Exemplo n.º 11
0
    // Called by the run animation at the correct frame.
    private void RunStep()
    {
        // Now we actually have to raycast downwards and check what type of terrain we're on.
        TerrainType type = FindTerrainStandingOn();

        switch (type)
        {
        case TerrainType.GRASS: AUD_Manager.SetSwitch("Surface_Type", "Grass", gameObject); break;

        case TerrainType.SAND: AUD_Manager.SetSwitch("Surface_Type", "Sand", gameObject); break;

        case TerrainType.CONCRETE: AUD_Manager.SetSwitch("Surface_Type", "Concrete", gameObject); break;

        case TerrainType.ERROR: break;
        }

        AUD_Manager.PostEvent(mRunStepEventName, gameObject);
    }
Exemplo n.º 12
0
 public void PickUp(Transform parentTransform)
 {
     foreach (Collider coll in collidersBeforePickup)
     {
         coll.isTrigger = true;
         coll.enabled   = false;
     }
     transform.parent        = parentTransform;
     transform.localRotation = Quaternion.Euler(rotationWhenPickedUp);
     initialLayer            = gameObject.layer;
     pickedUp         = true;
     gameObject.layer = layerWhenPickedUp;
     if (properties.transparencyWhenPickedup != 0.0)
     {
         SetTransparency(properties.transparencyWhenPickedup);
     }
     AUD_Manager.SetSwitch("ObjectAction", "Pickup", gameObject);
     AUD_Manager.PostEvent(properties.soundEventName, gameObject);
 }
Exemplo n.º 13
0
    /************************************************************************************************
    *  Each individual weapon will define how it fires its projectile.
    *  By the time this has been called we are sure that we are firing the weapon. We have already checked
    *  that we are loaded, charged, and nothing else is preventing us from firing.
    *
    *  Great opportunity to use Carlos's Event system.
    ************************************************************************************************/
    protected virtual void FireProjectile(Transform trans)
    {
        mFireTimeStamp = Time.time;

        // our plasma ray gun is as basic as it gets, spawning a plasmoid and then trying to re-chamber.
        // The target has already been set, and the projectile now simply has to have force added in the direction
        Vector3 dir = Vector3.Normalize(trans.position - transform.position);

        // GameObject clone = PhotonNetwork.Instantiate(mGunProperties.bullet.name, transform.position, Quaternion.LookRotation(dir, Vector3.up));
        dir = CalculateRandomError(dir);
        GameObject    clone = Instantiate(mRegGunProperties.bullet, firePoint.position, Quaternion.LookRotation(dir, Vector3.up));
        AI_Controller owner = UT_FindComponent.FindComponent <AI_Controller>(gameObject);

        if (owner != null)
        {
            clone.GetComponent <Bullet>().SetOwner(owner.transform);
        }
        else
        {
            clone.GetComponent <Bullet>().SetOwner(transform);
        }
        clone.GetComponent <Bullet>().SetTarget(trans);

        // Also, got to create those particles for the muzzle blast
        if (mGunProperties.mMuzzleBlast)
        {
            var mBlast = Instantiate(mGunProperties.mMuzzleBlast, firePoint.transform.position, transform.rotation);
        }

        for (int i = 0; i < mGunProperties.mSwitchGroups.Length; i++)
        {
            AUD_Manager.SetSwitch(mGunProperties.mSwitchGroups[i], mGunProperties.mSwitchStates[i], gameObject);
        }
        AUD_Manager.PostEvent(mGunProperties.mAudFireEvent, gameObject);

        // play the dialogue for our character shooting.
        AUD_Manager.DynamicDialogueFromData(owner.GetBase().mShootLine, gameObject);

        // Now push the event that a weapon has fired.
        owner.GetBase().mEnemyFired.Raise(null);
    }
Exemplo n.º 14
0
    private void OnTriggerEnter(Collider other)
    {
        // Deal with the two deflectors
        BulletDeflector deflector = other.GetComponent <BulletDeflector>();

        if (deflector != null)
        {
            return;
        }

        // Deal with player damage
        IDamageable damageableObject = other.GetComponentInParent <IDamageable>();

        if (damageableObject != null)
        {
            if (other.GetComponentInParent <PlayerHealth>() && bullet.bouncedByPlayer == false && effectiveDeflectorActive.Value == false)
            {
                damageableObject.TakeDamage(bullet.damage);
                AUD_Manager.SetSwitch("ImpactObject", "Character", gameObject);
                AUD_Manager.SetSwitch("ImpactType", "Kinetic", gameObject);
                AUD_Manager.PostEvent("WP_ProjImpact_ST", gameObject);
                bullet.DestroyBullet();
                return;
            }

            // SimpleEnemy se = other.GetComponent<SimpleEnemy>();
            // if (se != null && bullet.bouncedByPlayer == true) {
            //     se.TakeDamage(bullet.damage);
            //     bullet.DestroyBullet();
            //     return;
            // }


            EnemyForceField forceField = other.GetComponent <EnemyForceField>();
            if (forceField != null && bullet.bouncedByPlayer)
            {
                damageableObject.TakeDamage(bullet.damage);
                bullet.DestroyBullet();
                return;
            }
        }

        // Deal with killing the enemy
        AI_Controller enemyController = other.GetComponentInParent <AI_Controller>();

        if (enemyController != null && bullet.bouncedByPlayer)
        {
            enemyController.TakeDamage(bullet.damage);
            bullet.DestroyBullet();
            return;
        }

        // Handle Turret as well.
        AI_Turret turController = other.GetComponentInChildren <AI_Turret>();

        if (turController != null && bullet.bouncedByPlayer)
        {
            turController.TakeDamage(bullet.damage);
            bullet.DestroyBullet();
        }

        // Deal with any object
        if (other.GetComponent <DestroyObjectOnCollision>() != null)
        {
            ThrowableObject throwableObj = other.GetComponent <ThrowableObject>();
            if (throwableObj != null && bullet.bouncedPerfectly)
            {
                throwableObj.DestroyObject();
                return;
            }
            AUD_Manager.SetSwitch("ImpactObject", "Environment", gameObject);
            AUD_Manager.SetSwitch("ImpactType", "Energy", gameObject);
            AUD_Manager.PostEvent("WP_ProjImpact_ST", gameObject);
            bullet.DestroyBullet();
        }
    }
Exemplo n.º 15
0
 private void Awake()
 {
     AUD_Manager.SetState("BattleState", "NonEngaged");
     AUD_Manager.SetSwitch("Objective", "Objective1", gameObject);
     AUD_Manager.PostEvent("MS_GAMEPLAY_LP_PL", gameObject);
 }