void Start() { enemyAnimator = GetComponent <Animator>(); enemyController = GetComponent <EnemyController>(); enemyAudio = GetComponent <CharacterAudio>(); currentHealth = maxHealth; }
public override void PlayVocal(VocalType vocalType) { if (vocalType == VocalType.Surprise) { if (UnityEngine.Random.value > 0f) { int choice = UnityEngine.Random.Range(1, 4); CharacterAudio.PlayOneShot(GameManager.Inst.SoundManager.GetClip(MyReference.VocalSet.ToString() + "_surprise" + choice), 0.5f); } } if (vocalType == VocalType.Injury) { if (UnityEngine.Random.value > 0f) { int choice = UnityEngine.Random.Range(1, 4); CharacterAudio.PlayOneShot(GameManager.Inst.SoundManager.GetClip(MyReference.VocalSet.ToString() + "_injury" + choice), 0.6f); } } if (vocalType == VocalType.Death) { if (UnityEngine.Random.value > 0f) { int choice = UnityEngine.Random.Range(1, 4); CharacterAudio.PlayOneShot(GameManager.Inst.SoundManager.GetClip(MyReference.VocalSet.ToString() + "_death" + choice), 0.6f); } } }
private void Awake() { _shooter = GetComponent <Shooter>(); _enemyAnimator = GetComponent <EnemyAnimator>(); _characterAudio = GetComponent <CharacterAudio>(); _target = FindObjectOfType <Player>().transform; }
private void Awake() { animator = GetComponent <Animator>(); material = GetComponent <SpriteRenderer>().material; enemyAudio = GetComponent <CharacterAudio>(); health = maxHealth; StartCoroutine(spawn()); }
private void Awake() { rb = GetComponent <Rigidbody2D>(); animator = GetComponent <Animator>(); attackController = GetComponent <EnemyAttack>(); animator.speed = speed / baseSpeed; enemyAudio = GetComponent <CharacterAudio>(); }
void Start() { //playerController = GetComponent<PlayerController>(); playerAnimator = GetComponent <Animator>(); playerStats = GetComponent <CharacterStats>(); playerAudio = GetComponent <CharacterAudio>(); localSource = GetComponent <AudioSource>(); }
void Start() { playerAudio = GetComponent <CharacterAudio>(); localSource = GetComponent <AudioSource>(); GetNextLevelExp(); GetNextLevelDamage(); GetNewHealth(); currentHealth = maxHealth; }
void Awake() { character = this; m_MovementModel = MovementModel; m_InteractionModel = InteractionModel; m_MovementView = MovementView; m_InventoryModel = InventoryModel; m_AttackableCharacter = AttackableCharacter; m_CharacterAudio = AudioCharacter; }
private void Awake() { _shooter = GetComponent <EnemyShooter>(); _mover = GetComponent <EnemyMover>(); _jumper = GetComponent <EnemyJumper>(); _enemyAnimator = GetComponent <EnemyAnimator>(); _health = GetComponent <Health>(); _collider = GetComponent <BoxCollider>(); _enemyHolder = FindObjectOfType <EnemyHolder>(); _characterAudio = GetComponent <CharacterAudio>(); }
private void Awake() { _shooter = GetComponent <PlayerShooter>(); _playerAnimator = GetComponent <PlayerAnimator>(); _mover = GetComponent <PlayerMover>(); _health = GetComponent <Health>(); _mana = GetComponent <Mana>(); _playerAudio = GetComponent <CharacterAudio>(); _gameControls = new GameControls(); _gameControls.Gameplay.Shoot.started += OnShootActionStarted; _gameControls.Gameplay.Shoot.canceled += OnShootActionCancelled; }
public override GameObject CreateGameObject(ReferenceData referenceData, Transform parent = null) { var gameObject = base.CreateGameObject(referenceData, parent); var rigidbody = gameObject.AddComponent <Rigidbody>(); //rigidbody.isKinematic = true; rigidbody.constraints = RigidbodyConstraints.FreezeRotation; if (flags.HasFlag(CreatureFlags.Flies)) { rigidbody.useGravity = false; } CharacterAudio.Create(gameObject, soundGeneratorName); return(gameObject); }
protected override void Update() { base.Update(); if (PotentialStates.Length > 0 && stackOfStates.GetCurrentState() == null) { State idle = PotentialStates.FirstOrDefault(x => x.StateName == StateNames.IdleState); if (idle) { stackOfStates.PushState(idle); } } //audio queue if (!CharacterAudio) { return; } var AiStateAudio = Audio.FirstOrDefault(x => x.StateName == stackOfStates.GetCurrentState().StateName); if (AiStateAudio.Clips != null && AiStateAudio.Clips.Length > 0) { if (nextAudioQueueTime <= 0.0f) { nextAudioQueueTime = Random.Range(AiStateAudio.MinQueueTime, AiStateAudio.MaxQueueTime); } if (audioQueueTimer >= nextAudioQueueTime && !CharacterAudio.isPlaying) { //pick random audio clip int audioClipIndex = Random.Range(0, AiStateAudio.Clips.Length); CharacterAudio.clip = AiStateAudio.Clips[audioClipIndex]; CharacterAudio.Play(); nextAudioQueueTime = 0.0f; audioQueueTimer = 0.0f; } audioQueueTimer += Time.deltaTime; } }
public override GameObject CreateGameObject(ReferenceData referenceData, Transform parent = null) { var gameObject = base.CreateGameObject(referenceData, parent); gameObject.AddComponent <CharacterVoice>().Initialize(this); var body = gameObject.AddComponent <CharacterBody>(); body.Initialize(race, head, hair, npcFlags.HasFlag(NpcFlags.Female)); DialogController.Create(gameObject, this, referenceData); var characterData = gameObject.AddComponent <Character>(); characterData.Initialize(this); var animation = gameObject.GetComponent <CharacterAnimation>(); var inventory = gameObject.GetComponent <IInventory>(); var equipment = gameObject.GetComponent <CharacterEquipment>(); equipment.Initialize(animation, body, inventory); foreach (var collider in gameObject.GetComponentsInChildren <Collider>()) { collider.gameObject.layer = LayerMask.NameToLayer("Npc"); } AddServices(gameObject); var rigidbody = gameObject.AddComponent <Rigidbody>(); //rigidbody.isKinematic = true; rigidbody.constraints = RigidbodyConstraints.FreezeRotation; CharacterAudio.Create(gameObject); return(gameObject); }
private void Start() { charaAudioJump = GetComponentInChildren <CharacterAudio>(); mover = GetComponent <PlayerMover>(); groundTracker = GetComponent <GroundTracker>(); }
private void Awake() { audioPlayer = FindObjectOfType <CharacterAudio>(); }
protected void Awake() { m_movementController = gameObject.AddComponent<MovementController>(); m_characterAudio = GetComponentInChildren<CharacterAudio>(); m_characterAnimation = GetComponentInChildren<CharacterAnimation>(); }
void Start() { animator = GetComponent <Animator>(); playerAudio = GetComponent <CharacterAudio>(); UIController.instance.setBarMax(UIController.BULLET_BAR_TYPE, holdTime); }
private void Awake() { audioPlayer = FindObjectOfType <CharacterAudio>(); character = FindObjectOfType <CharacterController2D>(); }
private void Awake() { rb = GetComponent <Rigidbody2D>(); animator = GetComponent <Animator>(); playerAudio = GetComponent <CharacterAudio>(); }
// Start is called before the first frame update void Start() { m_CharacterData = character.GetComponent <CharacterData>(); m_CharacterAudio = character.GetComponent <CharacterAudio>(); restClient = GetComponent <IntentRestClient>(); }