// 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); } }
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; }
public void DeflectRandomly() { SetStartingDeflectionState(); SetRandomDirection(); Instantiate(particlesWhenBouncedRandomly, transform.position, transform.rotation); AUD_Manager.SetSwitch("Parry", "Almost", gameObject); AUD_Manager.PostEvent("PC_Perry_ST", gameObject); }
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"; }
// 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); }
// 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); }
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); }
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); }
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); }
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; } } }
// 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); }
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); }
/************************************************************************************************ * 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); }
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(); } }
private void Awake() { AUD_Manager.SetState("BattleState", "NonEngaged"); AUD_Manager.SetSwitch("Objective", "Objective1", gameObject); AUD_Manager.PostEvent("MS_GAMEPLAY_LP_PL", gameObject); }