コード例 #1
0
 protected virtual void EnqueueDownstream(T item)
 {
     if (NextElement != null && item != null)
     {
         NextElement.Enqueue(item);
     }
 }
コード例 #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;
    }
コード例 #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();
        }
コード例 #4
0
    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));
    }
コード例 #5
0
ファイル: ChainElement.cs プロジェクト: SilentKate/BaseGame
 protected void HandleNext(object context = null)
 {
     if (NextElement != null)
     {
         NextElement.Handle(context);
     }
     else
     {
         HandleFinished();
     }
 }
コード例 #6
0
        public void Cancel()
        {
            lock (this) {
                if (processing)
                {
                    canceled = true;
                }

                if (NextElement != null)
                {
                    NextElement.Cancel();
                }
            }
        }
コード例 #7
0
        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();
            }
        }
コード例 #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;
    }
コード例 #9
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);
        }
    }
コード例 #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);
        }
コード例 #11
0
 private void NextButtonPressed(object sender, EventArgs e)
 {
     NextElement?.Focus();
 }
コード例 #12
0
ファイル: Create.cs プロジェクト: katenovakivska/MSLabs
 public override void OutAct()
 {
     base.OutAct();
     TNext = TCurrent + GetDelay();
     NextElement.InAct(1);
 }