Exemple #1
0
    public void OnRespawnCursedTeleporter()
    {
        if (_POOL_DEAD_MINIONS.Count > 0 && _CrystalCursedLives > 0)
        {
            // Get the character from the end of the dead array
            GameObject   aiObj   = _POOL_DEAD_MINIONS[_POOL_DEAD_MINIONS.Count - 1].gameObject;
            Char_Crystal crystal = aiObj.GetComponent <Char_Crystal>();

            // Precaution
            if (crystal.GetVariantType() == Char_Crystal.CrystalType.Cursed)
            {
                // Get random int (min = 0, max = vector array.size -1)
                int randIndex = Random.Range(0, _TeleportingGateSpawnPositions.Count - 1);

                // Set crystal's transform to a random spawn position
                RespawnCrystal(crystal, _TeleportingGateSpawnPositions[randIndex].position);

                // Deduct 1 from respawn lives counter
                if (_UnlimitedLivesCursed == false)
                {
                    _CrystalCursedLives -= 1;
                }
            }
        }
    }
Exemple #2
0
    public void CollisionChecks()
    {
        // Precautions
        if (_Collision != null && _Active == true)
        {
            // Test against all alive necromancers in the game
            foreach (var necromancer in PlayerManager._pInstance.GetActiveNecromancers())
            {
                // Once collision against the necro has happened
                if (_Collision.bounds.Intersects(necromancer.GetCollider().bounds))
                {
                    // Pickup minion check
                    OnPickup(necromancer.GetComponent <Char_Geomancer>());

                    switch (_Crystal.GetVariantType())
                    {
                    case Char_Crystal.CrystalType.Minor: {
                        if (AiManager._pInstance._CrystalMinorSpawningBehaviour == AiManager.AiSpawningBehaviour.RandomSpawning)
                        {
                            // Spawn at random position within the arena bounds
                            AiManager._pInstance.OnRespawnMinorRandom();
                        }

                        if (AiManager._pInstance._CrystalMinorSpawningBehaviour == AiManager.AiSpawningBehaviour.TeleportingGates)
                        {
                            // Spawn behind a teleporter gate and move into the gameplay area
                            AiManager._pInstance.OnRespawnMinorTeleporter();
                        }

                        break;
                    }

                    case Char_Crystal.CrystalType.Major: {
                        if (AiManager._pInstance._CrystalMajorSpawningBehaviour == AiManager.AiSpawningBehaviour.RandomSpawning)
                        {
                            // Spawn at random position within the arena bounds
                            AiManager._pInstance.OnRespawnMajorRandom();
                        }

                        if (AiManager._pInstance._CrystalMajorSpawningBehaviour == AiManager.AiSpawningBehaviour.TeleportingGates)
                        {
                            // Spawn behind a teleporter gate and move into the gameplay area
                            AiManager._pInstance.OnRespawnMajorTeleporter();
                        }
                        break;
                    }

                    case Char_Crystal.CrystalType.Cursed: {
                        if (AiManager._pInstance._CrystalCursedSpawningBehaviour == AiManager.AiSpawningBehaviour.RandomSpawning)
                        {
                            // Spawn at random position within the arena bounds
                            AiManager._pInstance.OnRespawnCursedRandom();
                        }

                        if (AiManager._pInstance._CrystalCursedSpawningBehaviour == AiManager.AiSpawningBehaviour.TeleportingGates)
                        {
                            // Spawn behind a teleporter gate and move into the gameplay area
                            AiManager._pInstance.OnRespawnCursedTeleporter();
                        }
                        break;
                    }

                    default: {
                        break;
                    }
                    }
                    break;
                }
            }
        }
    }