Пример #1
0
        private void MainForm_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (e.Action == NotifyCollectionChangedAction.Add)
            {
                var n = this.container.Resolve <NeuronCollection>()[e.NewStartingIndex];
                n.Triggered += this.neuron_Triggered;
                n.Fired     += this.neuron_Fired;

                this.graphCountToolStripStatusLabel.Text = $"{this.container.Resolve<NeuronCollection>().Count} neurons loaded";
            }
            else if (e.Action == NotifyCollectionChangedAction.Replace && this.reactiveToolStripButton.Checked)
            {
                var old     = e.OldItems.Cast <Neurons.Neuron>().First();
                var newItem = e.NewItems.Cast <Neurons.Neuron>().First();

                if (!MainForm.IsAnalyzed(old) && MainForm.IsAnalyzed(newItem))
                {
                    var targets    = new SpikeTarget[] { new SpikeTarget(newItem.Id) };
                    var newTargets = targets.Concat(this.container.Resolve <ISpikeTargetListService>().Targets);

                    this.InitializeSpike();
                    this.container.Resolve <ISpikeService>().Spike(newTargets);
                }
            }
        }
Пример #2
0
    public override void Awake()
    {
        base.Awake();

        textCollider2D       = GetComponent <TextCollider2D>();
        textCollider2D.Color = GameConstantes.instance.currentTheme.instructionColor;
        textCollider2D.Font  = GameConstantes.instance.currentTheme.instructionFont;
        target         = gameObject.FindChild("Target").GetComponent <SpikeTarget>();
        target.parent  = this;
        targetCollider = target.gameObject.AddCopiedComponent(GetComponent <BoxCollider2D>());
    }