Inheritance: MonoBehaviour
Ejemplo n.º 1
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            var  ecb = m_EndSimulationEcbSystem.CreateCommandBuffer().ToConcurrent();
            Grow job = new Grow()
            {
                environmentSettings = Environment.environmentSettings,
                ecb = ecb
            };
            JobHandle jobHandle = job.Schedule(m_Group, inputDeps);

            m_EndSimulationEcbSystem.AddJobHandleForProducer(jobHandle);
            jobHandle.Complete();
            GrowPetals growPetals = new GrowPetals()
            {
                environmentSettings = Environment.environmentSettings,
                ecb = ecb,
                txAutoTrophCacheYPos  = GetComponentDataFromEntity <TxAutotrophCacheYPos>(),
                txAutotrophPhenotypes = GetComponentDataFromEntity <TxAutotrophPhenotype>(),
            };

            jobHandle = growPetals.Schedule(petalGroup, jobHandle);
            m_EndSimulationEcbSystem.AddJobHandleForProducer(jobHandle);
            jobHandle.Complete();
            return(jobHandle);
        }
Ejemplo n.º 2
0
 public Grow PutGrow(Grow originalEntity, GrowDto grow)
 {
     originalEntity.GrowName   = grow.GrowName;
     originalEntity.GrowNotes  = grow.GrowNotes;
     originalEntity.PublicGrow = grow.PublicGrow;
     return(originalEntity);
 }
Ejemplo n.º 3
0
        public RepositoryActionResult <Grow> PutGrow(int growId, Grow modifiedGrow,
                                                     Guid currentUserGuid)
        {
            if (modifiedGrow.UserGuid != currentUserGuid)
            {
                _dbContext.Entry(modifiedGrow).State = EntityState.Unchanged;
                return(new RepositoryActionResult <Grow>(modifiedGrow, RepositoryActionStatus.NotFound));
            }

            //_dbContext.Entry(modifiedUserGrow).State = EntityState.Modified;

            try
            {
                _dbContext.SaveChanges();
            }
            catch (DbUpdateConcurrencyException ex)
            {
                if (!GrowExists(growId))
                {
                    return(new RepositoryActionResult <Grow>(null, RepositoryActionStatus.Error, ex));
                }
                throw;
            }
            return(new RepositoryActionResult <Grow>(modifiedGrow, RepositoryActionStatus.Updated));
        }
    void Start()
    {
        Grow cityManager = FindObjectOfType <Grow>();

        cityManager.AddScaleSliderControl(transform.Find("Slider/Grip Scale").GetComponent <SliderControl>());
        cityManager.AddRotationSliderControl(transform.Find("Slider/Grip Rotate").GetComponent <SliderControl>());
    }
Ejemplo n.º 5
0
 public void HasGrown()
 {
     IsGrown = true;
     Console.ForegroundColor = ConsoleColor.Green;
     Grow?.Invoke($"{KindOfPlant} has grown");
     Console.ResetColor();
 }
Ejemplo n.º 6
0
    public void CalDividentBal()
    {
        try
        {
            double TotalBalance = 0;

            txtDividentBal.Text  = "0";
            txtTotalBalance.Text = "0";

            foreach (GridViewRow Grow in grdShareDividend.Rows)
            {
                if (((CheckBox)Grow.FindControl("chk")).Checked)
                {
                    Label DivBalance = (Label)Grow.FindControl("lblBalance") as Label;

                    TotalBalance = TotalBalance + Convert.ToDouble(DivBalance.Text.ToString() == "" ? "0" : DivBalance.Text.ToString());
                }
            }

            txtDividentBal.Text  = TotalBalance.ToString();
            txtTotalBalance.Text = Convert.ToDouble(Convert.ToDouble(txtBalance.Text.ToString() == "" ? "0" : txtBalance.Text.ToString()) + Convert.ToDouble(txtDividentBal.Text.ToString() == "" ? "0" : txtDividentBal.Text.ToString())).ToString();
            CreditAmount();
        }
        catch (Exception Ex)
        {
            ExceptionLogging.SendErrorToText(Ex);
        }
    }
Ejemplo n.º 7
0
 private void Grow(Grow grow)
 {
     age += grow.DaysToGrow;
     UpdateStageOfLife();
     AdjustHappiness((int)(-1 * stageOfLife.DailyHappinessDecrease * grow.DaysToGrow));
     stomach.Tell(new ProcessFood((int)(stageOfLife.DailyHunger * grow.DaysToGrow)));
 }
Ejemplo n.º 8
0
    // Use this for initialization
    void Start()
    {
        rigidbody        = GetComponent <Rigidbody>();
        interactionPoint = new GameObject().transform; //an empty object's transform
        velocityFactor   = rigidbody.mass;             //realistic -- bigger mass = smaller velocity factor

        growScript = gameObject.GetComponent <Grow>();
    }
Ejemplo n.º 9
0
        private void categories_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e)
        {
            Grow.Stop();
            TextBlock txtRef = (TextBlock)sender;

            Grow.SetValue(Storyboard.TargetNameProperty, txtRef.Name);
            Grow.Begin();
        }
Ejemplo n.º 10
0
    private static float Use(PowerUp.Abilities ability, Paddle paddle, bool begin, bool isServer)
    {
        // Switch of ability:
        switch (ability)
        {
        // If we are using the grow power up, call its respective function.
        case PowerUp.Abilities.Grow:
            if (begin)
            {
                Grow.Begin(paddle);
            }
            else
            {
                Grow.End(paddle);
            }

            return(Grow.Duration);

        // If we are using the shrink power up, call its respective function.
        case PowerUp.Abilities.Shrink:
            if (begin)
            {
                Shrink.Begin(paddle);
            }
            else
            {
                Shrink.End(paddle);
            }

            return(Shrink.Duration);

        // If we are using the confusion power up, call its respective function.
        case PowerUp.Abilities.Confusion:
            if (begin)
            {
                Confusion.Begin(paddle);
            }
            else
            {
                Confusion.End(paddle);
            }

            return(Confusion.Duration);

        // As ricochet is one time use, return zero as the duration and only use on begin.
        case PowerUp.Abilities.Ricochet:
            // Only run on server as this is change to the ball's velocity which the server controls.
            if (isServer && begin)
            {
                Ricochet.Use();
            }

            return(0f);
        }

        return(0f);
    }
Ejemplo n.º 11
0
        public void Grows()
        {
            int n = Program.random.Next(1, 11);

            for (int i = 0; i < n; i++)
            {
                Grow?.Invoke($"{KindOfPlant} grows");
                Thread.Sleep(1000);
            }
        }
Ejemplo n.º 12
0
 public GrowDto GetGrow(Grow grow)
 {
     return(new GrowDto
     {
         GrowId = grow.GrowId,
         GrowName = grow.GrowName,
         GrowNotes = grow.GrowNotes,
         CreateDateTime = grow.CreateDateTime,
         SystemDefaultGrow = grow.SystemDefaultGrow,
         PublicGrow = grow.PublicGrow,
         GrowSetting = _growSettingFactory.GetGrowSetting(grow.GrowSetting)
     });
 }
Ejemplo n.º 13
0
 private void spButtons_MouseEnter(object sender, System.Windows.RoutedEventArgs e)
 {
     if (spButtons.Visibility == System.Windows.Visibility.Collapsed)
     {
         spButtons.Visibility = System.Windows.Visibility.Visible;
         Grow.Begin();
         storyboardFlag = false;
     }
     else
     {
         Shrink.Begin();
         storyboardFlag = true;
     }
 }
Ejemplo n.º 14
0
    void CastSphere()
    {
        RaycastHit hit;

        if (Physics.SphereCast(transform.position, 1.0f, transform.TransformDirection(Vector3.down), out hit, 10))
        {
            float distanceToObstacle = hit.distance;
            Grow  grow = hit.transform.gameObject.GetComponent <Grow>();
            if (grow)
            {
                grow.Call();
            }
            Debug.Log("Spherecast distance: " + distanceToObstacle);
        }
    }
Ejemplo n.º 15
0
    IEnumerator CreatePowerUps()
    {
        var random = new System.Random();
        int randNum;

        while (Application.isPlaying)
        {
            if (!delay.IsDelayed)
            {
                randNum = random.Next(5);
                if (randNum == 0)
                {
                    print("Creating powerup");
                    var powerUp = Instantiate(PowerUp);
                    randNum = random.Next(5);
                    Ability ability = null;
                    switch (randNum)
                    {
                    case 0:
                        ability = new SpeedUp(gameBall, this);
                        break;

                    case 1:
                        ability = new SlowDown(gameBall, this);
                        break;

                    case 2:
                        ability = new Grow(leftPaddle, rightPaddle, gameBall);
                        break;

                    case 3:
                        ability = new Shrink(leftPaddle, rightPaddle, gameBall);
                        break;

                    case 4:
                        ability = new ChangeDirection(gameBall);
                        break;
                    }
                    var position = new Vector3((float)random.NextDouble() * 6 - 3, (float)random.NextDouble() * 6 - 3, 0);
                    powerUp.Init(ability, position);
                    PowerUpsOnField.Add(powerUp);
                    powerUp.GameManager = this;
                }
            }
            yield return(new WaitForSeconds(1f));
        }
    }
Ejemplo n.º 16
0
 public RepositoryActionResult <Grow> PostGrowSetting(Grow entity)
 {
     try
     {
         _dbContext.Grow.Add(entity);
         int result = _dbContext.SaveChanges();
         if (result > 0)
         {
             return(new RepositoryActionResult <Grow>(entity, RepositoryActionStatus.Created));
         }
         return(new RepositoryActionResult <Grow>(entity, RepositoryActionStatus.NothingModified, null));
     }
     catch (Exception ex)
     {
         return(new RepositoryActionResult <Grow>(null, RepositoryActionStatus.Error, ex));
     }
 }
Ejemplo n.º 17
0
        public RepositoryActionResult <Grow> DeleteGrow(int growId, Guid currentUserGuid)
        {
            try
            {
                Grow grow =
                    _dbContext.Grow.FirstOrDefault(
                        ug => ug.GrowId == growId && ug.UserGuid == currentUserGuid);
                if (grow != null)
                {
                    _dbContext.Grow.Remove(grow);

                    _dbContext.SaveChanges();
                    return(new RepositoryActionResult <Grow>(null, RepositoryActionStatus.Deleted));
                }
                return(new RepositoryActionResult <Grow>(null, RepositoryActionStatus.NotFound));
            }
            catch (Exception ex)
            {
                return(new RepositoryActionResult <Grow>(null, RepositoryActionStatus.Error, ex));
            }
        }
 internal SweetAlertOptionPOCO ToPOCO()
 {
     return(new SweetAlertOptionPOCO
     {
         Title = Title,
         TitleText = TitleText,
         Text = Text,
         Html = Html,
         Footer = Footer,
         Icon = Icon?.ToString(),
         IconColor = IconColor,
         IconHtml = IconHtml,
         Backdrop = Backdrop,
         Toast = Toast,
         Target = Target,
         Input = Input?.ToString(),
         Width = Width,
         Padding = Padding,
         Background = Background,
         Position = Position?.ToString(),
         Grow = Grow?.ToString(),
         ShowClass = ShowClass,
         HideClass = HideClass,
         CustomClass = CustomClass,
         Timer = Timer,
         TimerProgressBar = TimerProgressBar,
         HeightAuto = HeightAuto,
         AllowOutsideClick = AllowOutsideClick,
         AllowEscapeKey = AllowEscapeKey,
         AllowEnterKey = AllowEnterKey,
         StopKeydownPropagation = StopKeydownPropagation,
         KeydownListenerCapture = KeydownListenerCapture,
         ShowConfirmButton = ShowConfirmButton,
         ShowDenyButton = ShowDenyButton,
         ShowCancelButton = ShowCancelButton,
         ConfirmButtonText = ConfirmButtonText,
         DenyButtonText = DenyButtonText,
         CancelButtonText = CancelButtonText,
         ConfirmButtonColor = ConfirmButtonColor,
         DenyButtonColor = DenyButtonColor,
         CancelButtonColor = CancelButtonColor,
         ConfirmButtonAriaLabel = ConfirmButtonAriaLabel,
         DenyButtonAriaLabel = DenyButtonAriaLabel,
         CancelButtonAriaLabel = CancelButtonAriaLabel,
         ButtonsStyling = ButtonsStyling,
         ReverseButtons = ReverseButtons,
         FocusConfirm = FocusConfirm,
         FocusDeny = FocusDeny,
         FocusCancel = FocusCancel,
         ReturnFocus = ReturnFocus,
         ShowCloseButton = ShowCloseButton,
         CloseButtonHtml = CloseButtonHtml,
         CloseButtonAriaLabel = CloseButtonAriaLabel,
         LoaderHtml = LoaderHtml,
         ShowLoaderOnConfirm = ShowLoaderOnConfirm,
         ShowLoaderOnDeny = ShowLoaderOnDeny,
         PreConfirm = PreConfirm != null,
         PreDeny = PreDeny != null,
         ImageUrl = ImageUrl,
         ImageWidth = ImageWidth,
         ImageHeight = ImageHeight,
         ImageAlt = ImageAlt,
         InputLabel = InputLabel,
         InputPlaceholder = InputPlaceholder,
         InputValue = InputValue,
         InputOptions = InputOptions,
         InputAutoTrim = InputAutoTrim,
         InputAttributes = InputAttributes,
         InputValidator = InputValidator != null,
         ReturnInputValueOnDeny = ReturnInputValueOnDeny,
         ValidationMessage = ValidationMessage,
         ProgressSteps = ProgressSteps,
         CurrentProgressStep = CurrentProgressStep,
         ProgressStepsDistance = ProgressStepsDistance,
         WillOpen = WillOpen != null,
         DidClose = DidClose != null,
         DidDestroy = DidDestroy != null,
         DidOpen = DidOpen != null,
         WillClose = WillClose != null,
         DidRender = DidRender != null,
         ScrollbarPadding = ScrollbarPadding
     });
 }
Ejemplo n.º 19
0
        private void growAnimation(object sender, EventArgs e)
        {
            var growAnim = new Grow(_polyLibView.CurrentTriangulation, _numAnimFrames);

            _polyLibView.AddAnimation(growAnim);
        }
Ejemplo n.º 20
0
    void Behave()
    {
        //Sequence for going in an open door
        DebugTask         openDebug     = new DebugTask("Going through open door sequence");
        ConditionalIsTrue doorOpenCheck = new ConditionalIsTrue(door.isOpen);
        ArriveToTarget    goInRoom      = new ArriveToTarget(arrive, roomNavTarget);

        Task[] openDoorSystem = new Task[3];
        openDoorSystem[0] = openDebug;
        openDoorSystem[1] = doorOpenCheck;
        openDoorSystem[2] = goInRoom;
        Sequence doorOpenSequence = new Sequence(openDoorSystem);

        //Sequence for going in closed door
        DebugTask         closedDebug    = new DebugTask("Going through closed door sequence");
        ArriveToTarget    goToDoor       = new ArriveToTarget(arrive, doorNavTarget);
        ConditionalIsTrue tryOpeningDoor = new ConditionalIsTrue(door.TryOpening());
        OpenDoor          openTheDoorUp  = new OpenDoor(door);
        //As is, these arrives don't have timing so it will seem like just going into the room
        ArriveToTarget advanceIntoRoom = new ArriveToTarget(arrive, roomNavTarget);

        Task[] closedDoorSystem = new Task[5];
        closedDoorSystem[0] = closedDebug;
        closedDoorSystem[1] = goToDoor;
        closedDoorSystem[2] = tryOpeningDoor;
        closedDoorSystem[3] = openTheDoorUp;
        closedDoorSystem[4] = advanceIntoRoom;
        Sequence closedDoorSequence = new Sequence(closedDoorSystem);

        //Sequence for going in locked door
        //Can just reuse goToDoor!
        DebugTask          lockedDebug         = new DebugTask("Going through locked door sequence");
        ConditionalIsFalse tryOpeningDoorFalse = new ConditionalIsFalse(door.TryOpening());
        Grow     grow    = new Grow(2f, this.gameObject);
        BustDoor burstIn = new BustDoor(door);
        Stomp    stomp   = new Stomp(gameObject);

        //Can reuse advanceIntoRoom as well!
        Task[] lockedDoorSystem = new Task[7];
        lockedDoorSystem[0] = lockedDebug;
        lockedDoorSystem[1] = goToDoor;
        lockedDoorSystem[2] = tryOpeningDoorFalse;
        lockedDoorSystem[3] = grow;
        lockedDoorSystem[4] = burstIn;
        lockedDoorSystem[5] = stomp;
        lockedDoorSystem[6] = advanceIntoRoom;
        Sequence lockedDoorSequence = new Sequence(lockedDoorSystem);

        //Make a selector to try to go in closed door before locked
        Task[] closedDoorOptions = new Task[2];
        closedDoorOptions[0] = closedDoorSequence;
        closedDoorOptions[1] = lockedDoorSequence;
        Selector closedProtocols = new Selector(closedDoorOptions);

        //Make a selector to try to go in the open door before closed ones
        Task[] overallDoorProtocols = new Task[2];
        overallDoorProtocols[0] = doorOpenSequence;
        overallDoorProtocols[1] = closedProtocols;
        Selector overallDoorOptions = new Selector(overallDoorProtocols);

        overallDoorOptions.run();
    }