void SpawnPayload() { Data data = EquipmentManager.instance.GetRandomData().ToAssetData(); GameObject pickup = Instantiate(pickupPrefab, transform.TransformPoint(Vector3.up * 0.2f), Quaternion.identity); pickup.GetComponent <Pickup> ().Init(data, true); EdgeView.Create(pickup, true); }
public float timer = 0f; //for defend objectives void Awake() { instance = this; if (savedObjectiveId == 0) { savedObjectiveId = startingObjective; } curObjectiveId = savedObjectiveId; winScreen.SetActive(false); winText = winScreen.transform.Find("Window").Find("Title").GetComponent <Text>(); pc = GameObject.FindObjectOfType <PlayerController> (); objectiveEdgeView = EdgeView.Create(false); objectiveEdgeView.Hide(); PrepareObjectives(); if (gameTimer != null) { gameTimer.enabled = curObjective.timerActiveState; if (timeRemaining > 0) { gameTimer.Init(timeRemaining); return; } int firstTimerIndex = 0; //find the first event with a timer while (!objectives [firstTimerIndex].timerActiveState) { firstTimerIndex++; } if (firstTimerIndex > savedObjectiveId) { gameTimer.Init(objectives [firstTimerIndex].time); //set it to what it will start as } else { foreach (GameTimerEvent timerEvent in gameTimer.timerEvents) { if (timerEvent.isActivatedOncePassed && savedObjectiveId > timerEvent.objectiveIdsToActivateOn[0]) { timerEvent.onTimerEnd.Invoke(); //we finished the timer so invoke whatever methods we were supposed to invoke } } } } }
void UpdateObjectiveUI() { bool hasIndicators = objectives.Count > 0 && curObjectiveId < objectives.Count && curObjective.type != Objective.Type.Kills && curObjective.showsScreenIndicator; if (hasIndicators) { GameObject targetObj = (curObjective.overrideTarget == null) ? curObjective.objectiveObj : curObjective.overrideTarget; objectiveEdgeView.SetTarget(targetObj, curObjective.showsWorldIndicator); //set target } if (curObjective.type == Objective.Type.Kills) { Transform targetParent = curObjective.objectiveObj.transform; foreach (Transform child in targetParent) { if (child.name.Contains("Target")) { EdgeView.Create(child.gameObject, true); } } } if (curObjectiveId < objectives.Count && !string.IsNullOrEmpty(curObjective.helpText)) { NotificationManager.instance.ShowHelp(curObjective.helpText); } barAnim.SetBool("Open", curObjective.crucialHealth != null); if (curObjective.crucialHealth != null) { if (curObjective.icon != null) { barIcon.gameObject.SetActive(true); barIcon.sprite = curObjective.icon; } else { barIcon.gameObject.SetActive(false); } } }