//picks up object associated with this timer void Pickup(PickupTimer timer) { foreach (var pickupTimer in curPickingupTimers) { if (pickupTimer != timer) { pickupTimer.ResetTimer(); } } Pickup drop = timer.pickup.GetComponent <Pickup> (); if (drop != null) { if (drop.data.GetAssetType() == "Weapon") { SwitchWeapon(drop.data as WeaponData, drop.destoryLastPickup); } else if (drop.data.GetAssetType() == "Equipment") { SwitchEquipment(drop.data as EquipmentData); } Destroy(timer.pickup); } if (timer.type == PickupTimer.Type.Objective) { LevelProgressManager.instance.CompleteObjective(); if (drop == null) { EscortController escort = timer.pickup.GetComponentInParent <EscortController> (); if (escort == null) { timer.pickup.tag = "Untagged"; } else { escort.Enable(); } } } pickupTitleText.text = ""; //reset text }
void PrepareObjectives() { for (int i = 0; i < objectives.Count; i++) { if (i < savedObjectiveId) { if (objectives [i].objectsToDisable != null) { objectives [i].objectsToDisable.SetActive(false); } if (objectives [i].objectsToEnable != null) { objectives [i].objectsToEnable.SetActive(true); } //skip animations we have passed if (objectives [i].animation != null) { objectives [i].animation.SetTrigger("Skip"); } //these enemies are dead so don't bring them back if (objectives [i].type == Objective.Type.Kills) { objectives [i].objectiveObj.SetActive(false); } //reactivates escort EscortController escort = objectives [i].objectiveObj.GetComponent <EscortController> (); if (escort != null) { escort.Enable(); } } else { if (objectives [i].objectsToEnable != null) { objectives [i].objectsToEnable.SetActive(false); } } if (objectives [i].type == Objective.Type.Camera) { if (objectives [i].objectiveObj.GetComponent <Camera> () != null) { objectives [i].objectiveObj.SetActive(false); } } if (objectives [i].hasCameraEvent) { Objective newCameraObjective = new Objective(); newCameraObjective.type = Objective.Type.Camera; newCameraObjective.objectiveObj = objectives [i].objectiveObj; newCameraObjective.showsWorldIndicator = objectives [i].showsWorldIndicator; newCameraObjective.time = objectives[i].time; objectives [i].time = 0; objectives.Insert(i, newCameraObjective); i++; } } }