public ActivityCallbacks Start(ILevelSection section) { if (_started) { throw new InvalidOperationException("Already started"); } Analytics.CustomEvent(CustomEventNames.StartActivity, new Dictionary <string, object> { { CustomEventData.ActivityType, GetType().Name }, { CustomEventData.ActivityDifficulty, Difficulty } }); _started = true; _root = new GameObject(GetType().Name); Section = section; Section.EndSection.OnPlayerLeftActivity = PlayerLeftActivity; Section.EndSection.OnPlayerResumedActivity = ReturnedToActivity; Section.EndSection.OnPlayerEnteredEvaluation = ActivityEvaluationTriggered; Ressi = LocateRessiController(); BuildActivity(section, _root); _lapTimeStart = Time.time; Debug.Log("ACTIVITY ::: Player started activity"); return(_callbacks); }
protected override void BuildActivity(ILevelSection section, GameObject root) { _root = root; InitializeDependencies(); _activityInstances = AddActivityInstances(section).ToArray(); InitializeActivityEvents(); }
protected override void BuildActivity(ILevelSection section, GameObject root) { _root = root; _cameraMovement = Camera.main.GetComponent <CameraMovement>(); PopulateSectionWithActivityObjects(section); AddEnterTrigger(section.PlayArea.RightTerrainEdge); }
IEnumerable <DrawingActivityInstance> AddActivityInstances(ILevelSection section) { var distributor = new FeatureDistributor(); var drawingCount = Random.Range(2, 4); return(distributor.ScatterElements(Enumerable.Range(0, drawingCount).ToList(), leftBounds: section.PlayArea.LeftPlayAreaEdge.x, rightBounds: section.PlayArea.RightPlayAreaEdge.x, instantiater: (xPos, idx) => new DrawingActivityInstance(Ressi, _root, idx, xPos))); }
private void PopulateSectionWithActivityObjects(ILevelSection section, GameObject root) { var distributor = new FeatureDistributor(); _objectsInActivity = distributor.PlaceConsumables(_prefabCollection, section.PlayArea.LeftPlayAreaEdge.x, section.PlayArea.RightPlayAreaEdge.x); foreach (var consumableScript in _objectsInActivity) { consumableScript.OnConsume = ConsumeObject; consumableScript.transform.parent = root.transform; } }
void PopulateSectionWithActivityObjects(ILevelSection section) { var distributor = new FeatureDistributor(); var consumables = distributor.PlaceConsumables(_prefabCollection, section.PlayArea.LeftPlayAreaEdge.x, section.PlayArea.RightPlayAreaEdge.x); foreach (var consumable in consumables) { consumable.OnConsume = ConsumeObject; consumable.transform.parent = _root.transform; _objectsInActivity.Add(consumable); } }
/// <summary> /// Called when the activity should populate the scene with its game objects /// </summary> /// <param name="section">The section that holds the activity</param> /// <param name="root">The root that should hold all the game objects for this activity</param> protected abstract void BuildActivity(ILevelSection section, GameObject root);
protected override void BuildActivity(ILevelSection section, GameObject root) { _root = root; PopulateSectionWithActivityObjects(section, root); AddEnterTrigger(section.PlayArea.RightTerrainEdge, root); }