Skip to content
Permalink
07bb02fdb8
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
53 lines (44 sloc) 1.42 KB
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BossWeapon : MonoBehaviour
{
//same as user weapon really, enraged attack just makes faster
public int attackDamage = 20;
public int enragedAttackDamage = 40;
public Vector3 attackOffset;
public float attackRange = 1f;
public LayerMask attackMask;
public void Attack()
{
//attack circle
Vector3 pos = transform.position;
pos += transform.right * attackOffset.x;
pos += transform.up * attackOffset.y;
Collider2D colInfo = Physics2D.OverlapCircle(pos, attackRange, attackMask);
if (colInfo != null)
{
colInfo.GetComponent<Player>().TakeDamage(20);
}
}
//same as attack up their but animated more often
public void EnragedAttack()
{
Vector3 pos = transform.position;
pos += transform.right * attackOffset.x;
pos += transform.up * attackOffset.y;
Collider2D colInfo = Physics2D.OverlapCircle(pos, attackRange, attackMask);
if (colInfo != null)
{
colInfo.GetComponent<Player>().TakeDamage(30);
}
}
//draw circle in scene view
void OnDrawGizmosSelected()
{
Vector3 pos = transform.position;
pos += transform.right * attackOffset.x;
pos += transform.up * attackOffset.y;
Gizmos.DrawWireSphere(pos, attackRange);
}
}