コード例 #1
0
 void Start()
 {
     enemyAnimator   = GetComponent <Animator>();
     enemyController = GetComponent <EnemyController>();
     enemyAudio      = GetComponent <CharacterAudio>();
     currentHealth   = maxHealth;
 }
コード例 #2
0
    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);
            }
        }
    }
コード例 #3
0
    private void Awake()
    {
        _shooter        = GetComponent <Shooter>();
        _enemyAnimator  = GetComponent <EnemyAnimator>();
        _characterAudio = GetComponent <CharacterAudio>();

        _target = FindObjectOfType <Player>().transform;
    }
コード例 #4
0
 private void Awake()
 {
     animator   = GetComponent <Animator>();
     material   = GetComponent <SpriteRenderer>().material;
     enemyAudio = GetComponent <CharacterAudio>();
     health     = maxHealth;
     StartCoroutine(spawn());
 }
コード例 #5
0
 private void Awake()
 {
     rb               = GetComponent <Rigidbody2D>();
     animator         = GetComponent <Animator>();
     attackController = GetComponent <EnemyAttack>();
     animator.speed   = speed / baseSpeed;
     enemyAudio       = GetComponent <CharacterAudio>();
 }
コード例 #6
0
 void Start()
 {
     //playerController = GetComponent<PlayerController>();
     playerAnimator = GetComponent <Animator>();
     playerStats    = GetComponent <CharacterStats>();
     playerAudio    = GetComponent <CharacterAudio>();
     localSource    = GetComponent <AudioSource>();
 }
コード例 #7
0
 void Start()
 {
     playerAudio = GetComponent <CharacterAudio>();
     localSource = GetComponent <AudioSource>();
     GetNextLevelExp();
     GetNextLevelDamage();
     GetNewHealth();
     currentHealth = maxHealth;
 }
コード例 #8
0
    void Awake()
    {
        character = this;

        m_MovementModel       = MovementModel;
        m_InteractionModel    = InteractionModel;
        m_MovementView        = MovementView;
        m_InventoryModel      = InventoryModel;
        m_AttackableCharacter = AttackableCharacter;
        m_CharacterAudio      = AudioCharacter;
    }
コード例 #9
0
 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>();
 }
コード例 #10
0
ファイル: Player.cs プロジェクト: DeusIntra/Snowball-Fight
    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;
    }
コード例 #11
0
    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);
    }
コード例 #12
0
    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;
        }
    }
コード例 #13
0
    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);
    }
コード例 #14
0
ファイル: PlayerJump.cs プロジェクト: setrapp/ShroomCrunk
 private void Start()
 {
     charaAudioJump = GetComponentInChildren <CharacterAudio>();
     mover          = GetComponent <PlayerMover>();
     groundTracker  = GetComponent <GroundTracker>();
 }
コード例 #15
0
 private void Awake()
 {
     audioPlayer = FindObjectOfType <CharacterAudio>();
 }
コード例 #16
0
 protected void Awake()
 {
     m_movementController = gameObject.AddComponent<MovementController>();
     m_characterAudio = GetComponentInChildren<CharacterAudio>();
     m_characterAnimation = GetComponentInChildren<CharacterAnimation>();
 }
コード例 #17
0
 void Start()
 {
     animator    = GetComponent <Animator>();
     playerAudio = GetComponent <CharacterAudio>();
     UIController.instance.setBarMax(UIController.BULLET_BAR_TYPE, holdTime);
 }
コード例 #18
0
 private void Awake()
 {
     audioPlayer = FindObjectOfType <CharacterAudio>();
     character   = FindObjectOfType <CharacterController2D>();
 }
コード例 #19
0
 private void Awake()
 {
     rb          = GetComponent <Rigidbody2D>();
     animator    = GetComponent <Animator>();
     playerAudio = GetComponent <CharacterAudio>();
 }
コード例 #20
0
ファイル: Shortcuts.cs プロジェクト: samlet/personal-3d-fe
 // Start is called before the first frame update
 void Start()
 {
     m_CharacterData  = character.GetComponent <CharacterData>();
     m_CharacterAudio = character.GetComponent <CharacterAudio>();
     restClient       = GetComponent <IntentRestClient>();
 }