Esempio n. 1
0
    protected override IEnumerator CastStep()
    {
        Explosion e = SC.effects["explosion"] as Explosion;

        e.color_1 = color_1;
        e.color_2 = color_2;

        e.speed = 10f;


        Promise <Vector2> target = SC.ui.GetAbilityTarget();

        while (!target.fulfilled && !target.broken)
        {
            yield return(null);
        }
        if (target.broken)
        {
            yield break;
        }

        Vector2 origin = GM.player.aim_transform.position;

        e.Play(origin);
        e.speed = 5f;
        e.transform.localScale = Vector3.one * .8f;
        for (int i = 0; i < needle_number; i++)
        {
            Carrier.Create(origin + Random.insideUnitCircle * .5f, AttackData.Create(1, "hit", GM.player), target, "laser");
            SC.sounds.PlayResource("laser", .3f, new FloatRange(.9f, 1.1f));
            yield return(new WaitForSeconds(needle_delay));
        }
        e.Stop();
    }
Esempio n. 2
0
    protected override IEnumerator CastStep()
    {
        Promise <Vector2> target = SC.ui.GetAbilityTarget();

        while (!target.fulfilled && !target.broken)
        {
            yield return(null);
        }
        if (target.broken)
        {
            yield break;
        }

        Vector2 target_vector = target;

        for (int i = 0; i < needle_number; i++)
        {
            Vector2 origin = GM.player.aim_transform.position;
            Carrier.Create(origin + Random.insideUnitCircle * .5f, AttackData.Create(3, "hit", GM.player), target_vector, "fireball");
            SC.sounds.PlayResource("player_shoot", .3f, new FloatRange(.9f, 1.1f));
            yield return(new WaitForSeconds(needle_delay));

            target_vector = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        }
    }
Esempio n. 3
0
    protected override void LeftHold()
    {
        base.LeftHold();
        if (!SC.controls.active)
        {
            return;
        }
        if (attack_delay <= 0f)
        {
            Vector3 mousePosition = Input.mousePosition;

            mousePosition.z = mousePosition.z - (Camera.main.transform.position.z - 45);

            Carrier.Create(GM.player.aim_transform.position, AttackData.Create(1, "hit", GM.player), Camera.main.ScreenToWorldPoint(mousePosition), "player_bullet");
            attack_delay = SC.player_stats.attack_delay;
            SC.sounds.PlayResource("player_shoot", .3f, new FloatRange(.9f, 1.1f));
        }
    }
Esempio n. 4
0
    protected override void Update()
    {
        base.Update();
        List <Character> chars = new List <Collider2D>(Physics2D.OverlapCircleAll(transform.position, attack_range)).ConvertAll(c2d => c2d.GetComponent <Character>());

        if (chars.Contains(target))
        {
            if (next_attack < 0f)
            {
                next_attack = attack_delay;
                target.ReceiveAttack(AttackData.Create(attack, "hit", this));
                anim.SetTrigger("attack");
            }
        }
        if (!stunned)
        {
            next_attack -= Time.deltaTime;
        }
    }
Esempio n. 5
0
    protected override IEnumerator CastStep()
    {
        Vector2 origin = GM.player.aim_transform.position;

        Promise <Vector2> target = SC.ui.GetAbilityTarget();

        while (!target.fulfilled && !target.broken)
        {
            yield return(null);
        }
        if (target.broken)
        {
            yield break;
        }
        for (int i = 0; i < 20; i++)
        {
            Carrier.Create(origin + Random.insideUnitCircle * .5f, AttackData.Create(0, "stun", GM.player), Camera.main.ScreenToWorldPoint(Input.mousePosition), "stun");
            SC.sounds.PlayResource("player_shoot", .3f, new FloatRange(.9f, 1.1f));
            yield return(new WaitForSeconds(.05f));
        }
    }
Esempio n. 6
0
    protected override IEnumerator Pursue()
    {
        while (true)
        {
            yield return(new WaitForSeconds(pursuit_delay));

            MoveTo(FindPositionOnCircle(GM.player.transform.position, radius_range, angle_range));
            while (SC.routines.IsRunning(char_movement_routine_name))
            {
                yield return(null);
            }
            yield return(new WaitForSeconds(move_shoot_delay));

            for (int i = 0; i < projectile_number; i++)
            {
                Carrier.Create(transform.position, AttackData.Create(attack, "hit", this), target.transform.position + (Random.insideUnitCircle * spread).Vector3(), projectile_type);
                anim.SetTrigger("attack");
                SC.sounds.PlayResource("enemy_shoot", .3f, new FloatRange(.9f, 1.1f));
                yield return(new WaitForSeconds(projectile_delay));
            }
        }
    }