Пример #1
0
 public void RemoveDropCrate(EnemyLootCrate lootCrateToRemove)
 {
     if (!lootingAll && droppedCrates != null)
     {
         droppedCrates.Remove(lootCrateToRemove);
     }
 }
Пример #2
0
    public EnemyLootCrate GenerateEnemyLootCrate()
    {
        if (dropParameters == null)
        {
            Debug.Log("Pas de parametres de drop assignés");
            return(null);
        }

        DropContent dropContent = default;

        if (arenaDropManager != null)
        {
            dropContent = dropParameters.GenerateEnemyLootCrateContent(arenaDropManager.HasToDropEquipment, arenaDropManager.CanDropEquipment);
        }
        else
        {
            dropContent = dropParameters.GenerateEnemyLootCrateContent(false, true);
        }

        if (dropContent.IsNull)
        {
            Debug.Log("pas de bol, pas de loot");
            return(null);
        }

        EnemyLootCrate lootCrate = GameManager.gameManager.PoolManager.GetLootCrate(LootCratePoolTag.Normal, PoolInteractionType.GetFromPool);

        lootCrate.SetBoxLoot(dropContent.GetGoldAmount, dropContent.GetEquipment);

        return(lootCrate);
    }
Пример #3
0
    public void ReturnLootCrate(EnemyLootCrate lootCrate)
    {
        if (!lootCratePoolsDictionary.ContainsKey(lootCrate.GetLootCratePoolTag))
        {
            return;
        }

        lootCratePoolsDictionary[lootCrate.GetLootCratePoolTag].AddObjectInPool(lootCrate);
    }
Пример #4
0
    public void AddDropCrate(EnemyLootCrate newLootCrate)
    {
        if (droppedCrates == null)
        {
            droppedCrates = new List <EnemyLootCrate>();
        }

        droppedCrates.Add(newLootCrate);

        if (newLootCrate != null)
        {
            if (newLootCrate.GetLootedEquipment != null)
            {
                currentNumberOfDroppedEquipments++;
            }
        }
    }
Пример #5
0
    public override void Die()
    {
        if (!alreadyDead)
        {
            base.Die();

            ArenaManager arenaManager = ArenaManager.arenaManager;

            EnemyLootCrate lootCrate = lootManager.GenerateEnemyLootCrate();
            if (lootCrate != null)
            {
                lootCrate.transform.position = transform.position;
                lootCrate.SetUpFloatingMove();

                if (arenaManager != null)
                {
                    arenaManager.DropManager.AddDropCrate(lootCrate);
                }
            }

            if (arenaManager != null)
            {
                arenaManager.IncreaseNumberOfKilledEnemies();
            }

            shipBody.velocity    = Vector3.zero;
            shipBody.constraints = RigidbodyConstraints.FreezeAll;

            if (shipBoxCollider != null)
            {
                shipBoxCollider.enabled = false;
            }

            if (shipFeedbacks != null)
            {
                shipFeedbacks.DesactivateSlowParticles();
            }

            if (attackPreparationWarningAnim != null)
            {
                attackPreparationWarningAnim.gameObject.SetActive(false);
            }
        }

        #region Variables reset
        externalySetedUp = false;

        remainingStunDuration       = 0;
        skeweringProjectile         = null;
        currentProtectionParameters = default;
        remainingBlindingDuration   = 0;

        currentReactionTime   = 0;
        lastPredictedPosition = Vector3.zero;

        remainingTimeBeforeExitRoutine   = 0;
        remainingTimeBeforeBackToRoutine = 0;
        outOfRoutineModificationCoeff    = 0;

        watchingRoundParameters = default;

        targetShip = null;

        nextPhaseIndex = 0;

        relatedDetectionZone.ResetDetectionZone();
        #endregion
    }
Пример #6
0
    public void Die()
    {
        OnDeath?.Invoke(this);

        ArenaManager arenaManager = ArenaManager.arenaManager;

        EnemyLootCrate lootCrate = lootManager.GenerateEnemyLootCrate();

        if (lootCrate != null)
        {
            lootCrate.transform.position = transform.position;
            lootCrate.SetUpFloatingMove();

            if (arenaManager != null)
            {
                arenaManager.DropManager.AddDropCrate(lootCrate);
            }
        }


        if (objectCollider != null)
        {
            objectCollider.enabled = false;
        }
        else if (GetComponent <Collider>() != null)
        {
            GetComponent <Collider>().enabled = false;
        }


        if (particlesToPlay != null)
        {
            particlesToPlay.Play();
        }

        foreach (Transform tr in woodProjectionPositions)
        {
            FeedbackObject woodProjection = GameManager.gameManager.PoolManager.GetFeedbackObject(FeedbackObjectPoolTag.WoodDestruction, PoolInteractionType.GetFromPool);
            if (woodProjection != null)
            {
                woodProjection.transform.position = tr.position;
                woodProjection.StartFeedback(2, 0.2f);
            }
        }

        if (particlesToPlay == null && woodProjectionPositions.Length == 0)
        {
            FeedbackObject woodProjection = GameManager.gameManager.PoolManager.GetFeedbackObject(FeedbackObjectPoolTag.WoodDestruction, PoolInteractionType.GetFromPool);
            if (woodProjection != null)
            {
                woodProjection.transform.position = transform.position;
                woodProjection.StartFeedback(2, 0.2f);
            }
        }


        if (targetAudioSource != null)
        {
            targetAudioSource.PlaySound(soundToPlayOnDestroy);
        }


        if (objectRenderer != null)
        {
            objectRenderer.enabled = false;
        }

        foreach (GameObject obj in objectRenderers)
        {
            obj.SetActive(false);
        }

        if (objectRenderer == null && objectRenderers.Length == 0)
        {
            Destroy(gameObject);
        }
    }