void CheckifTargetVisibleByCamera() { if (objectTracked == 1) { Objective trackedScript = TargetObject.GetComponent <Objective>(); if (trackedScript.isVisibleByPlayerCamera) { TargetIsVisibleByPlayerCamera = true; } else { TargetIsVisibleByPlayerCamera = false; } } else if (objectTracked == 2) { UFOBehaviour trackedScript = TargetObject.GetComponent <UFOBehaviour>(); if (trackedScript.isVisibleByCamera) { TargetIsVisibleByPlayerCamera = true; } else { TargetIsVisibleByPlayerCamera = false; } } }
void DieOnTargetDeath() { if (objectTracked == 2) { UFOBehaviour trackedScript = TargetObject.GetComponent <UFOBehaviour>(); if (trackedScript.deathDelayTimer < 300) { Destroy(gameObject); } else { } } }
void SpawnUFO() { if (UFOSpawnPoints.Length != UFOObjectivePoints.Length) { Debug.Log("ERROR: UFO spawnpoints do not have a usable number of objective points!"); } else { int spawnPointIndex = Random.Range(0, UFOSpawnPoints.Length); UFOBehaviour spawnedScript = UFO.GetComponent <UFOBehaviour>(); spawnedScript.mySpawnerScript = GetComponent <EnemySpawner>(); spawnedScript.objectivePoint = UFOObjectivePoints[spawnPointIndex]; spawnedScript.levelCanvas = levelCanvas; spawnedScript.PlayerCamera = PlayerCamera; spawnedScript.wayPointArrowSpawnPoint = wayPointArrowSpawnPoint; Instantiate(UFO, UFOSpawnPoints[spawnPointIndex].position, UFOSpawnPoints[spawnPointIndex].rotation); DropWarning.StartOver(); foesSinceLastUFO = 0; } //spawn a ufo every 10 enemies that have been spawned so the player has a little extra challenge to it. }
void collectUFOHealthForDisplay(UFOBehaviour ufoScript) { enemyHealthSlider.value = (ufoScript.health * 100) / 40; enemyHealthDecreaseSlider.value = ufoScript.healthInChange; }
void EnemyUFOHit(UFOBehaviour targetScript) { targetScript.TakeDamage(damage); }