Beispiel #1
0
 protected virtual void EnqueueDownstream(T item)
 {
     if (NextElement != null && item != null)
     {
         NextElement.Enqueue(item);
     }
 }
Beispiel #2
0
    void Start()
    {
        CommonData.Play          = true;
        CommonData.Logo_GameOver = Logo_Game_Over;
        CommonData.Logo_GameOver.SetActive(false);
        CommonData.Logo_Tetris = Logo_Tetris;
        CommonData.Logo_Tetris.SetActive(false);
        CommonData.Logo_Pause = logo_Pause;
        CommonData.Logo_Pause.SetActive(false);
        CommonData.timestep_Go        = false;
        CommonData.Tetris_Logo_bool   = false;
        CommonData.animation_1_active = false;
        CommonData.animation_2_active = false;
        CommonData.compressactive     = false;
        CommonData.stepafteranimation = true;
        CommonData.CommonArr          = new int[CommonData.Height, CommonData.Lenght];
        CommonData.PoolCubes          = new GameObject[CommonData.Height, CommonData.Lenght];
        Parent_lines = new GameObject();

        for (int i = 0; i < CommonData.Height; i++)
        {
            for (int k = 0; k < CommonData.Lenght; k++)
            {
                CommonData.CommonArr[i, k] = 0;
                CommonData.PoolCubes[i, k] = Instantiate(CubePrefab);
            }
        }
        nextElement     = new NextElement();
        blockController = new BlockController(nextElement.GeneretedSBT(CommonData.hint.NumberElement));
        ResetPosition();
        TimeLevelCount = 1;
    }
Beispiel #3
0
        override public void OutAct()
        {
            base.OutAct();
            CreateQuantity++;

            base.TNext = base.TCurr + base.GetDelay();

            PatientType patientType = FindPatientType();

            Patient patient = new Patient()
            {
                Index       = CreateQuantity,
                startTime   = TCurr,
                PatientType = new PatientType
                {
                    AvRegisterTime = patientType.AvRegisterTime,
                    Name           = patientType.Name,
                    Frequency      = patientType.Frequency
                }
            };

            NextElement.CurrentPatient = patient;

            NextElement.InAct();
        }
    protected virtual bool _IsClosed(AbstractElement beginningElement = null)
    {
        var goToNext       = NextElement != null;
        var reachedClosure = beginningElement == this;

        if (reachedClosure)
        {
            return(true);
        }
        return(goToNext && NextElement._IsClosed(beginningElement ?? this));
    }
Beispiel #5
0
 protected void HandleNext(object context = null)
 {
     if (NextElement != null)
     {
         NextElement.Handle(context);
     }
     else
     {
         HandleFinished();
     }
 }
Beispiel #6
0
        public void Cancel()
        {
            lock (this) {
                if (processing)
                {
                    canceled = true;
                }

                if (NextElement != null)
                {
                    NextElement.Cancel();
                }
            }
        }
        private void HandleNextAction(object sender, TextView.EditorActionEventArgs e)
        {
            e.Handled = false;
            if (e.ActionId == ImeAction.Next && NextElement != null)
            {
                NextElement?.Focus();
                e.Handled = true;
            }

            if (!e.Handled)
            {
                Element.PressEnter();
            }
        }
Beispiel #8
0
    void ResetGame(BlockController bc)
    {
        CommonData.Play      = true;
        CommonData.CommonArr = new int[CommonData.Height, CommonData.Lenght];
        for (int i = 0; i < CommonData.Height; i++)
        {
            for (int k = 0; k < CommonData.Lenght; k++)
            {
                CommonData.CommonArr[i, k] = 0;
            }
        }
        NextElement nextElement = new NextElement();

        bc.stateBlockTetris = nextElement.GeneretedSBT(CommonData.hint.NumberElement);
        Line_table          = 0;
        Score_table         = 0;
        CommonData.Line     = 0;
        CommonData.Score    = 0;
    }
    protected virtual void GiveProperties()
    {
        var listOfConnectedElements = NextElement == null ? null : NextElement.GetListOfConnectedElements(this);

        if (listOfConnectedElements == null)
        {
            Debug.Log("No connected elements.");
            return;
        }
        Debug.Log(string.Format("Connected elements: {0}", listOfConnectedElements.GetReadableList()));
        var batteries = listOfConnectedElements.OfType <Battery>();
        var batteryU  = (from battery in batteries select battery.Properties.Current).ToList <double>().Sum();

        var circuitR = (from element in listOfConnectedElements where !(element is BranchEndElement) select element.Properties.Resistance).ToList <double>().Sum();
        var amperage = batteryU / circuitR;

        foreach (var connectedElement in listOfConnectedElements)
        {
            //connectedElement.Properties.SetIR(batteryU / circuitR, connectedElement.Properties.Resistance);
            connectedElement.SetAmperage(amperage);
        }
    }
Beispiel #10
0
        public override void OutAct()
        {
            base.OutAct();
            int index = 0;

            if (PatientsTypes.Count > 0)
            {
                index = patientType.ChooseProbability(PatientsTypes) - 1;
                foreach (var t in PatientsTypes)
                {
                    if (index + 1 == t.Index)
                    {
                        t.Quantity++;
                    }
                }
            }

            TNext = TCurrent + GetDelay();

            NextElement.AverageDelay = PatientsTypes[index].AvgTimeOfRegistration;
            NextElement.InAct(PatientsTypes[index].Index);
        }
Beispiel #11
0
 private void NextButtonPressed(object sender, EventArgs e)
 {
     NextElement?.Focus();
 }
Beispiel #12
0
 public override void OutAct()
 {
     base.OutAct();
     TNext = TCurrent + GetDelay();
     NextElement.InAct(1);
 }