Пример #1
0
    /// <summary>
    /// Raises the attack event.
    /// </summary>
    public override void OnAttack(WeaponHitbox hitbox)
    {
        var hb = hitbox as Arrow;

        if (hb != null)
        {
            hb.Direction = hb.Direction.RotateY(hb.transform.localRotation.eulerAngles.y);
        }
    }
Пример #2
0
    private void OnTriggerEnter(Collider other)
    {
        WeaponHitbox enemy = other.gameObject.GetComponent <WeaponHitbox>();

        if ((other.gameObject.tag == "Weapon") && (hitStun <= 0.05) && (enemy != null))
        {
            health -= enemy.damage;
            hitStun = enemy.attackSpeed;
        }
    }
Пример #3
0
    /// <summary>
    /// Raises the attack event.
    /// </summary>
    public override void OnAttack(WeaponHitbox hitbox)
    {
        if (_cameraTrack == null || _playerController == null)
        {
            _playerController = Parent.GetComponent <PlayerMovement>();
            _cameraTrack      = Parent.GetComponent <CameraTrack>();
        }

        _hitbox = hitbox as BoomerangHitbox;
        _hitbox.StartFlight(_cameraTrack, _playerController);
    }
Пример #4
0
    public virtual void startAttacking(Transform playerTransform, PlayerHands hands)
    {
        //spawn weapon at location
        GameObject currentlySpawnedWeapon = Instantiate(weaponPrefab, playerTransform);

        currentlySpawnedWeapon.AddComponent <SpriteRenderer>();
        currentlySpawnedWeapon.GetComponent <SpriteRenderer>().sprite = itemGraphic;
        currentlySpawnedWeapon.AddComponent <PolygonCollider2D>();
        WeaponHitbox hitbox = currentlySpawnedWeapon.AddComponent <WeaponHitbox>();

        hitbox.init(this);
        currentlySpawnedWeapon.layer = 8;

        hands.spawnedItem = currentlySpawnedWeapon;
    }
Пример #5
0
 /// <summary>
 /// Raises the attack event.
 /// </summary>
 public override void OnAttack(WeaponHitbox hitbox)
 {
     _canAttack = false;
 }
Пример #6
0
 /// <summary>
 /// Called when the attack button is pressed.
 /// </summary>
 public abstract void OnAttack(WeaponHitbox hitbox);