コード例 #1
0
    public void SpinAttack() //boss targets where player currently is and twirls scythe moving towards that location
    {
        animator.ResetTrigger("Slash");
        animator.SetBool("Spinning", true);

        FindObjectOfType <AudioManager>().Play("BossSpinAtk");
        mode = "Spinning";

        targetPosition = player.transform.position; //simply pick where the player is

        int     bossBorderLayer  = LayerMask.NameToLayer("BossRoomBorder");
        Vector2 relativePosition = player.transform.position - transform.position;

        relativePosition = relativePosition.normalized; //get vector for direction
        RaycastHit2D hit = Physics2D.Raycast(transform.position, relativePosition, 100, 1 << bossBorderLayer);

        if (hit.collider != null)
        {
            targetPosition = hit.point;
            Debug.DrawRay(transform.position, relativePosition, Color.green, 2f);
        }

        if (spinHitBox != null)
        {
            Destroy(spinHitBox);
            Debug.Log("destroyed hitbox");
        }

        BasicHitbox hitBox = Instantiate(attackHitBox, transform).GetComponent <BasicHitbox>();

        spinHitBox = hitBox.gameObject;
        hitBox.Initialize("Enemy", new Vector2(8f, 5f), new Vector2(0, 0), 100f, 20, 4f);
    }
コード例 #2
0
    public void SlashAttack()
    {
        animator.ResetTrigger("Hit");
        animator.ResetTrigger("Slash");

        mode     = "Idle";
        idleTime = 2f;

        FindObjectOfType <AudioManager>().Play("BossAtk");
        Vector3 spawnPosition = transform.position;

        spawnPosition += spriteRenderer.flipX ? transform.right * -1 : transform.right * 1;
        BasicHitbox hitBox = Instantiate(attackHitBox, spawnPosition, Quaternion.identity).GetComponent <BasicHitbox>();

        hitBox.Initialize("Enemy", new Vector2(1.5f, 1.5f), new Vector2(0, 0), .1f, 20, 2f);

        if (comboing)
        {
            idleTime = 1f;
        }
        else
        {
            idleTime = 2f;
        }
    }
コード例 #3
0
    public void SpinAttack()
    {
        Vector3 spawnPosition = transform.position;

        BasicHitbox hitBox = Instantiate(attackHitBox, transform).GetComponent <BasicHitbox>();

        FindObjectOfType <AudioManager>().Play("SpinAtk"); //sfx
        hitBox.Initialize("Player", new Vector2(10, 7.5f), new Vector2(0, 0), .3f, 30, 5);
    }
コード例 #4
0
    public void BasicMeleeAttack()
    {
        Vector3 spawnPosition = transform.position;

        spawnPosition += spriteRenderer.flipX ? transform.right * -1 : transform.right * 1;
        BasicHitbox hitBox = Instantiate(attackHitBox, spawnPosition, Quaternion.identity).GetComponent <BasicHitbox>();

        FindObjectOfType <AudioManager>().Play("Slash"); //sfx
        hitBox.Initialize("Player", new Vector2(2, 2), new Vector2(0, 0), .1f, 20, 3);
    }
コード例 #5
0
    public void SpawnHitbox()
    {
        animator.ResetTrigger("Attack");
        currentCooldown = attackCooldown;
        Vector3 spawnPosition = transform.position;

        spawnPosition += spriteRenderer.flipX ? transform.right * 1 : transform.right * -1;
        BasicHitbox hitBox = Instantiate(attackHitBox, spawnPosition, Quaternion.identity).GetComponent <BasicHitbox>();

        hitBox.Initialize("Enemy", new Vector2(1.5f, 1.5f), new Vector2(0, 0), .1f, 25, 2.5f);
    }
コード例 #6
0
    public void GolemAttack()
    {
        FindObjectOfType <AudioManager>().Play("GolemAtk"); //sfx
        animator.ResetTrigger("Attack");
        currentCooldown = attackCooldown;
        Vector3 spawnPosition = transform.position;

        spawnPosition += spriteRenderer.flipX ? transform.right * 1 : transform.right * -1;
        BasicHitbox hitBox = Instantiate(attackHitBox, spawnPosition, Quaternion.identity).GetComponent <BasicHitbox>();

        hitBox.Initialize("Enemy", new Vector2(3f, 3.5f), new Vector2(-1, 1.6f), 1f, 40, 4f);
    }
コード例 #7
0
 /// <summary>
 /// Constructs a new attack unit action.
 /// </summary>
 /// <param name="unit">The unit that owns this action.</param>
 /// <param name="cost">The energy cost of this action.</param>
 /// <param name="damage">The damage amount of this action.</param>
 /// <param name="hitbox">The damage hitbox of this action.</param>
 public AttackEachUnitAction(BasicUnitProperty unit, int cost, int damage, BasicHitbox hitbox) : base(unit, cost)
 {
     this.Damage = damage;
     this.Hitbox = hitbox;
 }