private void Die() { // For now, not using object pooling. In the future, potentially just set GEtComponent<Renderer>().enabled = false; mState = STATE.DEAD; if (mRed) { Instantiate(mBase.mRedDeathParticles, transform.position, transform.rotation); } else { Instantiate(mBase.mBlueDeathParticles, transform.position, transform.rotation); } if (mRed) { Instantiate(mBase.mRedDeathMark, transform.position, transform.rotation); } else { Instantiate(mBase.mBlueDeathMark, transform.position, transform.rotation); } Instantiate(mBase.mDeathScream, transform.position, transform.rotation); mMaster.HandleDeadNPC(this); AUD_Manager.DynamicDialogueFromData(mBase.mDeathDialogue, gameObject); Destroy(transform.parent.gameObject); }
private void OnCollisionEnter(Collision other) { if (mEntity.mState == STATE.FLYING) { AUD_Manager.DynamicDialogueFromData(mHitsWall, gameObject); mEntity.mStateChange = STATE.COMBAT; mEntity.TakeDamage(60f); } }
private void Update() { if (!mWaitingForPlayer) { return; } if (Time.time - mSectionDoneTimeStamp > mDelay) { AUD_Manager.DynamicDialogueFromData(mSectionDone, gameObject); mSectionDoneTimeStamp = Time.time; } }
public void TakeDamage(float damage) { if (GetComponentInChildren <EnemyForceField>()) { return; } mHealth -= damage; // If we haven't died, play our damage sound if (mHealth > 0f) { AUD_Manager.DynamicDialogueFromData(mBase.mGeneralDamage, gameObject); } }
private void OnCollisionEnter(Collision other) { if (mEntity.mState == STATE.FLYING) { // Only collisions with the floor matter. Debug.Log("Collision while falling with: " + other.gameObject); if (other.gameObject.tag == "Ground") { AUD_Manager.DynamicDialogueFromData(mHitsGround, gameObject); mEntity.TakeDamage(20f); mEntity.mStateChange = STATE.COMBAT; } } }
private void Fire() { mFireTimeStamp = Time.time; Vector3 dir = Vector3.Normalize(mVictim.position - transform.position); GameObject clone; bool red = (Random.value < 0.5); if (red) { clone = Instantiate(mCannonProperties.mRedBullet, mFirePoint.position, Quaternion.LookRotation(dir, Vector3.up)); } else { clone = Instantiate(mCannonProperties.mBlueBullet, mFirePoint.position, Quaternion.LookRotation(dir, Vector3.up)); } clone.GetComponent <Bullet>().SetOwner(mEntity.transform); clone.GetComponent <Bullet>().SetTarget(mVictim); Instantiate(mGunProperties.mMuzzleBlast, mFirePoint.transform.position, transform.rotation); AUD_Manager.PostEvent(mGunProperties.mAudFireEvent, gameObject); AUD_Manager.DynamicDialogueFromData(mEntity.GetBase().mShootLine, gameObject); mEntity.GetBase().mEnemyFired.Raise(null); // Tank cannon specific stuff. mNumFiredThisVolley++; if (mNumFiredThisVolley == mCannonProperties.mNumInVolley) { mState = CANNON_STATE.CHARGING; mCurChargeAmt = 0f; mNumFiredThisVolley = 0; } else { mState = CANNON_STATE.PREFIRE; mCurChamberAmt = 0f; } }
/************************************************************************************************ * 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); }
IEnumerator PlayDialogueDelayed(SO_AD_Dialogue data) { yield return(new WaitForSeconds(mDelay.Value)); AUD_Manager.DynamicDialogueFromData(data, gameObject); }
private void Start() { AUD_Manager.DynamicDialogueFromData(mDialogue, gameObject); }
// hack, but we're also setting state to not paused. public void PlayLevelStartLine() { AUD_Manager.SetState("PauseMenu", "ResumeGame"); AUD_Manager.DynamicDialogueFromData(mLevelStart, gameObject); }
public void OnExitScreen() { AUD_Manager.DynamicDialogueFromData(mExit, gameObject); }