Exemplo n.º 1
0
        private void Reload(DispenserData.Type itemType)
        {
            switch (itemType)
            {
            case DispenserData.Type.Normal:
                SetMachineGun();
                break;

            case DispenserData.Type.LaserBeam:
                SetLaserBeam();
                break;

            case DispenserData.Type.Missile:
                SetMissileGun();
                break;

            case DispenserData.Type.EMP:
                SetEMPGun();
                break;

            case DispenserData.Type.Shield:
                SetShieldGun();
                break;

            default:
                break;
            }
        }
Exemplo n.º 2
0
 void ShieldLogic(float takingDamage, DispenserData.Type damageType)
 {
     if (damageType != DispenserData.Type.LaserBeam)
     {
         GetComponentInChildren <EnemyShieldHealth>().TakeDamage(takingDamage);
     }
 }
Exemplo n.º 3
0
    /// <summary>
    /// Allow to check if the Player is controlling and not using the laser beam to active the laser sight
    /// </summary>
    // private bool IsUsingLaserSight => _inputReciever.GetInUse() && ammoType != DispenserData.Type.LaserBeam;

    #region Railgun - BACKLOG

    //[Header("Railgun Ammo set")]
    //public float RailgunRange = 50f;
    //public float RailgunDamage = 20f;
    //public int RailgunAmmo = 100;
    //public float RailgunTimeFireRate = 0f;
    //public float RailgunFireRate = 10f;

    //private void Railgun(bool setFire)
    //{
    //    if (setFire && LaserAmmo > 0f && (Time.time >= RailgunTimeFireRate))
    //    {
    //        RailgunTimeFireRate = Time.time + (1f / RailgunFireRate);
    //        if (!LaserBeamer.enabled)
    //        {
    //            LaserBeamer.enabled = true;
    //        }
    //        RaycastHit2D hit = Physics2D.Raycast(CannonFirePoint.transform.position, CannonFirePoint.transform.up, LaserRange);
    //        LaserBeamer.SetPosition(0, CannonFirePoint.transform.position);
    //        if (hit)
    //        {
    //            //LaserBeamer.SetPosition(1, LaserRange);
    //            Collider2D collider = hit.collider;
    //            if (collider)
    //            {
    //                IDamageable<float> damageable = collider.GetComponentInParent<EnemyHealth>();
    //                if (damageable != null)
    //                {
    //                    //   damageable.TakeDamage(RailgunDamage);
    //                }
    //            }
    //        }
    //        LaserBeamer.SetPosition(1, CannonFirePoint.transform.up * LaserRange);
    //        RailgunAmmo--;
    //    }
    //    else
    //    {
    //        LaserBeamer.enabled = false;
    //    }
    //}

    #endregion

    public void Reload(DispenserData.Type type)
    {
        ammoType = type;
        switch (ammoType)
        {
        case DispenserData.Type.Normal:
        {
            _weaponNormalGun.Reload();
        }
        break;

        case DispenserData.Type.LaserBeam:
        {
            _weaponLaserBeam.Reload();
        }
        break;

        case DispenserData.Type.Missile:
        {
            _weaponMissile.Reload();
        }
        break;

        default: break;
        }
        Debug.Log($"Ammo: {ammoType} reloaded!");
    }
Exemplo n.º 4
0
 void HpLogic(float takingDamage, DispenserData.Type damageType)
 {
     health -= takingDamage;
     Debug.Log(tag + "Lost " + takingDamage + "hp. Current health: " + health);
     StartCoroutine(DamageIndicator());
     //if (health <= 0.0f)
     //{
     //    Destroy(gameObject);
     //    Debug.Log("I will be back!");
     //}
 }
Exemplo n.º 5
0
    public void TakeDamage(float takingDamage, DispenserData.Type damageType)
    {
        if (CompareTag("ShieldEnemy"))
        {
            if (!GetComponentInChildren <EnemyShieldHealth>().ShieldIsActive)
            {
                HpLogic(takingDamage, damageType);
            }
            else
            {
                ShieldLogic(takingDamage, damageType);
            }
        }


        if (CompareTag("Enemy"))
        {
            HpLogic(takingDamage, damageType);
        }
    }
Exemplo n.º 6
0
 public void Setup(ref DispenserItem dispenserItem)
 {
     _spriteRenderer.sprite = dispenserItem.ItemSprite;
     ItemType = dispenserItem.Type;
 }