private void Awake()
    {
        rb   = GetComponent <Rigidbody2D>();
        anim = GetComponentInChildren <Animator>();

        hurt_source        = rb.AddAS();
        hurt_source.clip   = hurt_sound;
        melee_source       = rb.AddAS();
        melee_source.pitch = .5f;
        melee_source.clip  = melee_sound;
        death_source       = rb.AddAS();
        death_source.clip  = death_sound;

        m_light       = GetComponentInChildren <Light>();
        m_light.color = red;

        health = GetComponent <Health>();
        health.SetHealth(starting_health);

        HUI.maxHealth = starting_health;

        HUI.gameObject.SetActive(false);

        target_node = nodes[1];

        colors[0] = orange;
        colors[1] = purple;
        colors[2] = green;
        colors[3] = red;
        colors[4] = blue;
    }
    private void Awake()
    {
        rb         = GetComponent <Rigidbody2D>();
        anim       = GetComponentInChildren <Animator>();
        light_anim = transform.GetChild(2).GetComponent <Animator>();

        fb_spawn_list.Add(g0);
        fb_spawn_list.Add(g1);
        fb_spawn_list.Add(g2);
        fb_spawn_list.Add(g3);
        fb_spawn_list.Add(g4);
        fb_spawn_list.Add(g5);

        hurt_source            = rb.AddAS();
        hurt_source.pitch      = .5f;
        summon_source          = rb.AddAS();
        summon_source.clip     = summon_sound;
        transition_source      = rb.AddAS();
        transition_source.clip = transition_sounds[0];

        m_light = GetComponentInChildren <Light>();

        health = GetComponent <Health>();
        health.SetHealth(starting_health);

        HUI.maxHealth = starting_health;

        target_node = nodes[1];
    }
Beispiel #3
0
    private void Awake()
    {
        rb = GetComponent <Rigidbody2D>();
        normal_beep_wait = new WaitForSeconds(normal_beep_freq);
        fast_beep_wait   = new WaitForSeconds(fast_beep_freq);

        m_light      = transform.GetChild(2).GetComponent <Light>();
        m_beep_light = transform.GetChild(3).GetComponent <Light>();

        beep_source        = rb.AddAS();
        beep_source.clip   = beep;
        beep_source.volume = beep_volume;
        beep_source.pitch  = Random.Range(.9f, 1.1f);
        boom_source        = rb.AddAS();
        boom_source.clip   = booms[Random.Range(0, booms.Length)];
        boom_source.volume = boom_volume;

        normal_beeping_co = StartCoroutine(NormalBeeping());

        target_masks    = new LayerMask[4];
        target_masks[0] = enemy_mask;
        target_masks[1] = player_mask;
        target_masks[2] = boss_mask;
        target_masks[3] = hurt_entity_mask;
    }
Beispiel #4
0
    private void Awake()
    {
        rb        = GetComponent <Rigidbody2D>();
        sr        = GetComponentInChildren <SpriteRenderer>();
        explosion = transform.GetChild(0).gameObject;
        l         = transform.GetChild(1).GetComponent <Light>();

        throw_source        = rb.AddAS();
        throw_source.clip   = throw_sound;
        throw_source.pitch  = Random.Range(.08f, .12f);
        throw_source.volume = .5f;
        boom_source         = rb.AddAS();
        boom_source.clip    = booms[Random.Range(0, booms.Length)];

        target_masks    = new LayerMask[4];
        target_masks[0] = player_mask;
        target_masks[1] = enemy_mask;
        target_masks[2] = hurt_entity_mask;
        target_masks[3] = boss_mask;
    }
    protected virtual void Awake()
    {
        rb   = GetComponent <Rigidbody2D>();
        anim = GetComponentInChildren <Animator>();

        m_light = GetComponentInChildren <Light>();

        health = GetComponent <Health>();
        health.SetHealth(m_enemy_starting_health);

        HUI.maxHealth = m_enemy_starting_health;

        melee_dmg    = m_melee_damage;
        melee_force  = m_melee_force;
        pixel_offset = pixel_offset_from_bottom;

        hit_source   = rb.AddAS();
        hurt_source  = rb.AddAS();
        death_source = rb.AddAS();

        hurt_source.volume = m_hurt_volume;

        death_source.clip = m_death_sounds[Random.Range(0, m_death_sounds.Length)];

        hit_source.pitch   = m_sound_pitch * 2;
        hurt_source.pitch  = m_sound_pitch;
        death_source.pitch = m_sound_pitch;

        enemy_hurt_time = new WaitForSeconds(m_enemy_hurt_time_float);
        enemy_hit_time  = new WaitForSeconds(m_enemy_hit_time_float);

        m_path          = GetComponent <Pathfinding.IAstarAI>();
        m_path.maxSpeed = m_movement_speed;

        m_dest = GetComponent <Pathfinding.AIDestinationSetter>();

        can_attack = true;
    }
Beispiel #6
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        movement = GetComponent <PlayerMovement>();
        combat   = GetComponent <PlayerCombat>();

        rb   = GetComponent <Rigidbody2D>();
        anim = GetComponent <Animator>();

        m_light = GetComponentInChildren <Light>();

        melee_time        = new WaitForSeconds(m_melee_time_float);
        energy_regen_time = new WaitForSeconds(m_energy_regen_time_float);
        chef_hurt_time    = new WaitForSeconds(m_chef_hurt_time_float);
        chef_dizzy_time   = new WaitForSeconds(m_chef_dizzy_time_float);
        quarter_second    = new WaitForSeconds(.25f);

        melee_dmg    = chef_melee_dmg;
        melee_force  = chef_melee_force;
        pixel_offset = pixel_offset_from_bottom;

        melee_attack_source = rb.AddAS();
        hit_source          = rb.AddAS();
        hurt_source         = rb.AddAS();
        knife_throw_source  = rb.AddAS();

        death_source      = rb.AddAS();
        dizzy_source      = rb.AddAS();
        death_source.clip = death_sound;
        dizzy_source.clip = dizzy_sound;

        walk_source        = rb.AddAS();
        walk_source.clip   = walk_sound;
        walk_source.loop   = true;
        walk_source.volume = .5f;

        Physics2D.IgnoreLayerCollision(10, 8, false);

        health = GetComponent <Health>();
        health.SetHealth(chef_starting_health);

        HUI.maxHealth = chef_max_health;
    }