Пример #1
0
 /// <inheritdoc/>
 public override void InitializeEffector(ScenarioTrigger trigger, TriggerEffector effector)
 {
     if (!(effector is WaitForDistanceEffector waitForDistanceEffector))
     {
         throw new ArgumentException(
                   $"{GetType().Name} received effector of invalid type {effector.GetType().Name}.");
     }
     waitForDistanceEffector.MaxDistance = 5.0f;
 }
Пример #2
0
        /// <summary>
        /// Initializes new prefab for the effector edit panel
        /// </summary>
        /// <param name="customEffectorPanels">Custom effector panels that will be used instead of default ones</param>
        /// <param name="effector">Effector for which panel will be added</param>
        /// <returns>Effectors panel that will be used for editing the effector</returns>
        private void InitializeEffectorPanel(Dictionary <Type, EffectorEditPanel> customEffectorPanels,
                                             TriggerEffector effector)
        {
            var panelPrefab = defaultEffectorEditPanel.GetComponent <EffectorEditPanel>();

            if (customEffectorPanels.TryGetValue(effector.GetType(), out var editPanel))
            {
                panelPrefab = editPanel.GetComponent <EffectorEditPanel>();
            }
            effectorPanelsPrefabs.Add(effector.TypeName, panelPrefab);
        }
Пример #3
0
 /// <inheritdoc/>
 public override void Setup(ScenarioTrigger trigger, TriggerEffector effector)
 {
     base.Setup(trigger, effector);
     waitingPointEffector = effector as WaitingPointEffector;
     if (waitingPointEffector == null)
     {
         throw new ArgumentException(
                   $"{GetType().Name} received effector of invalid type {effector.GetType().Name}.");
     }
     Refresh();
 }
 /// <inheritdoc/>
 public override void InitializeEffector(ScenarioTrigger trigger, TriggerEffector effector)
 {
     if (!(effector is ControlTriggerEffector triggerEffector))
     {
         throw new ArgumentException(
                   $"{GetType().Name} received effector of invalid type {effector.GetType().Name}.");
     }
     triggerEffector.ControllablesUIDs.Clear();
     triggerEffector.ControlPolicy = new List <ControlAction>();
     policyEditPanel.Setup(null, triggerEffector.ControlPolicy);
 }
Пример #5
0
 /// <inheritdoc/>
 public override void InitializeEffector(ScenarioTrigger trigger, TriggerEffector effector)
 {
     if (!(effector is WaitingPointEffector waitingPointEffector))
     {
         throw new ArgumentException(
                   $"{GetType().Name} received effector of invalid type {effector.GetType().Name}.");
     }
     //Put the activator point nearby the trigger
     waitingPointEffector.ActivatorPoint =
         trigger.transform.position + zoneVisualization.transform.localPosition;
     waitingPointEffector.PointRadius = 2.0f;
 }
Пример #6
0
        /// <inheritdoc/>
        public override void EffectorAddedToTrigger(ScenarioTrigger trigger, TriggerEffector effector)
        {
            if (!(effector is WaitingPointEffector waitingPointEffector))
            {
                throw new ArgumentException(
                          $"{GetType().Name} received effector of invalid type {effector.GetType().Name}.");
            }
            var zone = trigger.GetEffectorObject(effector, zoneVisualization.name);

            if (zone != null)
            {
                return;
            }
            zone = trigger.AddEffectorObject(effector, zoneVisualization.name, zoneVisualization);
            zone.transform.position   = waitingPointEffector.ActivatorPoint;
            zone.transform.localScale = Vector3.one * waitingPointEffector.PointRadius;
            zone.gameObject.SetActive(true);
            var zoneComponent = zone.GetComponent <WaitingPointZone>();

            zoneComponent.Refresh();
        }