public ExperienceCounter(Growth growthType, int firstLevel = 100)
 {
     _growth = growthType;
     _last = 0;
     _firstLevel = firstLevel;
     _toNext = firstLevel;
     Level = 1;
 }
Exemplo n.º 2
0
        public Armor(string id)
        {
            XmlDocument xml = new XmlDocument();
            xml.Load(new MemoryStream(Encoding.UTF8.GetBytes(_table[id])));

            _name = xml.SelectSingleNode("//name").InnerText;
            _desc = xml.SelectSingleNode("//desc").InnerText;
            _defense = Int32.Parse(xml.SelectSingleNode("//def").InnerText);
            _defensePercent = Int32.Parse(xml.SelectSingleNode("//defp").InnerText);
            _magicDefense = Int32.Parse(xml.SelectSingleNode("//mdf").InnerText);
            _magicDefensePercent = Int32.Parse(xml.SelectSingleNode("//mdfp").InnerText);

            _slots = new Materia[Int32.Parse(xml.SelectSingleNode("//slots").InnerText)];
            _links = Int32.Parse(xml.SelectSingleNode("//links").InnerText);
            if (_links > _slots.Length / 2)
                throw new GamedataException("Materia pairs greater than number of slots");
            _growth = (Growth)Enum.Parse(typeof(Growth), xml.SelectSingleNode("//growth").InnerText);
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Delete(long id, Growth growth)
        {
            if (!IsLoggedIn())
            {
                return(RedirectToPage("/Account/Login"));
            }

            Growth preSaveGrowth = await context.Growths.AsNoTracking().Include(g => g.Infant).FirstOrDefaultAsync(g => g.GrowthId == id);

            if (!IsGrowthOwner(preSaveGrowth))
            {
                return(RedirectToPage("/Error/Error404"));
            }

            long infantId = growth.InfantId;

            context.Growths.Remove(growth);
            await context.SaveChangesAsync();

            return(RedirectToAction("Index", "Dashboard", new { id = infantId }));
        }
Exemplo n.º 4
0
    void OnCollisionStay2D(Collision2D collision)
    {
        var hit = collision.gameObject;

        //hits--;

        Growth gr = hit.GetComponent <Growth>();

        if (gr != null)
        {
            gr.superShrinkReaction();
        }

        Enemy en = hit.GetComponent <Enemy>();

        if (en != null)
        //if (en.inv < 0)
        {
            en.die();
        }
    }
Exemplo n.º 5
0
 void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.tag == "Mass")
     {
         Debug.Log("Mass eaten");
         transform.localScale += new Vector3(0.1f, 0.1f, 0.1f);
         Destroy(other.gameObject);
         score++;
     }
     if (other.gameObject.tag == "Enemy")
     {
         enemy_gr = other.gameObject.GetComponent <Growth>();
         if (enemy_gr.score < score)
         {
             Debug.Log("Enemy ate enemy");
             transform.localScale += new Vector3(0.1f, 0.1f, 0.1f);
             Destroy(other.gameObject);
             score++;
         }
     }
     if (other.gameObject.tag == "Player")
     {
         other_gr = other.gameObject.GetComponent <Growth>();
         if (other_gr.score < score)
         {
             Debug.Log("Enemy ate player");
             transform.localScale += new Vector3(0.1f, 0.1f, 0.1f);
             Destroy(other.gameObject);
             isPlayerAlive = false;
             score++;
         }
         if (other_gr.score > score)
         {
             Debug.Log("Player ate enemy");
             other.gameObject.transform.localScale += new Vector3(0.1f, 0.1f, 0.1f);
             Destroy(gameObject);
             other_gr.score++;
         }
     }
 }
Exemplo n.º 6
0
    public override void OnPrepare()
    {
        if (LeafNo == null)
        {
            Initialise();
        }

        Growth.Clear();
        Senescing.Clear();
        Detaching.Clear();
        Retranslocation.Clear();
        GreenRemoved.Clear();
        SenescedRemoved.Clear();

        dlt_dm_pot_rue         = 0.0;
        dlt_n_senesced_retrans = 0.0;
        dlt_n_senesced_trans   = 0.0;
        dlt_height             = 0.0;
        dlt_width = 0.0;

        _NDemand         = 0.0;
        _SoilNDemand     = 0.0;
        NMax             = 0.0;
        sw_demand_te     = 0.0;
        sw_demand        = 0.0;
        dltLAI           = 0.0;
        dltSLAI          = 0.0;
        dltLAI_pot       = 0.0;
        dltLAI_stressed  = 0.0;
        dltLAI_carbon    = 0.0; // (PFR)
        dltSLAI_detached = 0.0;
        dltSLAI_age      = 0.0;
        dltSLAI_light    = 0.0;
        dltSLAI_water    = 0.0;
        dltSLAI_frost    = 0.0;
        dltLeafNo        = 0.0;
        //    g.dlt_node_no              = 0.0; JNGH - need to carry this through for site no next day.
        dltLeafNoPot = 0.0;
        dltNodeNoPot = 0.0;
    }
Exemplo n.º 7
0
        public Weapon(string id)
        {
            XmlDocument xml = new XmlDocument();
            xml.Load(new MemoryStream(Encoding.UTF8.GetBytes(_table[id])));

            _name = xml.SelectSingleNode("//name").InnerText;
            _desc = xml.SelectSingleNode("//desc").InnerText;

            _attack = Int32.Parse(xml.SelectSingleNode("//atk").InnerText);
            _attackPercent = Int32.Parse(xml.SelectSingleNode("//atkp").InnerText);
            _magic = Int32.Parse(xml.SelectSingleNode("//mag").InnerText);
            _criticalPercent = Int32.Parse(xml.SelectSingleNode("//critp").InnerText);
            _longRange = Boolean.Parse(xml.SelectSingleNode("//longrange").InnerText);

            _element = (Element)Enum.Parse(typeof(Element), xml.SelectSingleNode("//element").InnerText);
            _type = (WeaponType)Enum.Parse(typeof(WeaponType), xml.SelectSingleNode("//type").InnerText);

            _slots = new Materia[Int32.Parse(xml.SelectSingleNode("//slots").InnerText)];
            _links = Int32.Parse(xml.SelectSingleNode("//links").InnerText);
            if (_links > _slots.Length / 2)
                throw new GamedataException("Materia pairs greater than number of slots");
            _growth = (Growth)Enum.Parse(typeof(Growth), xml.SelectSingleNode("//growth").InnerText);
        }
Exemplo n.º 8
0
    public void PlaceTree(TreeType tree_type, int x, int y, Growth tree_growth)
    {
        if (!ValidIndex(x, y))
        {
            throw new UnityException("wtf ? x,y= " + x + "," + y);
        }

        VisualTree tree = null;
        var        seed = MonoRefCenter.instance.Get(tree_type);


        if (seed == null)
        {
            throw new UnityException("wtf ? type= " + tree_type);
        }

        tree = Instantiate <VisualTree>(seed);

        trees[x, y] = tree;
        tree.transform.SetParent(transform);
        tree.Init(Pos(x, y), x, y);
        // tree set growth
    }
Exemplo n.º 9
0
        private int DrawBarByMouse(Growth growth, Rect areaRect, out float value)
        {
            var selection = -1;

            value = 0f;

            var mousePos = new Vector2(Event.current.mousePosition.x - areaRect.x,
                                       Event.current.mousePosition.y - areaRect.y);

            if (areaRect.Contains(Event.current.mousePosition))
            {
                var xPerc = Mathf.InverseLerp(0, areaRect.width, mousePos.x);
                var yPerc = Mathf.InverseLerp(0, areaRect.height, mousePos.y);

                selection = Mathf.FloorToInt(Mathf.Lerp(0, growth.MaxLevel, xPerc));

                value = Mathf.Lerp(growth.MaxValue, growth.MinValue, yPerc);
                value = RoundDecimal(value);
                if (Event.current.button == 1)
                {
                    var menu = new GenericMenu();
                    menu.AddItem(new GUIContent("+1"), false,
                                 () => growth.CachedValues[selection]++);
                    menu.AddItem(new GUIContent("-1"), false,
                                 () => growth.CachedValues[selection]--);
                    menu.AddItem(new GUIContent("min"), false,
                                 () => growth.CachedValues[selection] =
                                     growth.MinValue);
                    menu.AddItem(new GUIContent("max"), false,
                                 () => growth.CachedValues[selection] =
                                     growth.MaxValue);
                    menu.ShowAsContext();
                }
            }

            return(selection);
        }
Exemplo n.º 10
0
    public ShiftingMemoryOfAges()
        : base(
            new SpiritPresence(
                new PresenceTrack(Track.Energy0, Track.Energy1, Track.Energy2, Prepare(3), Track.Energy4, Track.Reclaim1Energy, Track.Energy5, Prepare(6)),
                new PresenceTrack(Track.Card1, Track.Card2, Track.Card2, DiscardElementsForCardPlay, Track.Card3)
                ),
            PowerCard.For <BoonOfAncientMemories>(),
            PowerCard.For <ElementalTeachings>(),
            PowerCard.For <ShareSecretsOfSurvival>(),
            PowerCard.For <StudyTheInvadersFears>()
            )
    {
        Growth = new Growth(
            new GrowthOption(new ReclaimAll(), new PlacePresence(0)),
            new GrowthOption(new DrawPowerCard(), new PlacePresence(2)),
            new GrowthOption(new PlacePresence(1), new GainEnergy(2)),
            new GrowthOption(new GainEnergy(9))
            );

        InnatePowers = new InnatePower[] {
            InnatePower.For <LearnTheInvadersActions>(),
            InnatePower.For <ObserveTheEverChangingWorld>()
        };
    }
Exemplo n.º 11
0
        private static void ScoreFields(Growth first, Growth second, ref int score, ref int maxScore)
        {
            if (first == Growth.Other)
            {
                return;
            }
            maxScore += 1;
            switch (first)
            {
            case Growth.Little when(int) second <= 150:
                score += 1;

                break;

            case Growth.Small when 151 <= (int)second && (int)second <= 170:
                score += 1;
                break;

            case Growth.High when(int) second >= 171:
                score += 1;

                break;
            }
        }
Exemplo n.º 12
0
        public void Validate_WithOxidaseAndGrowthSet_IsValid(Growth growthGrowthOnBloodAgar, Growth growthOnMartinLewisAgar, TestResult oxidaseTestResult)
        {
            var dto = CreateValidModel();

            dto.GrowthOnBloodAgar       = growthGrowthOnBloodAgar;
            dto.GrowthOnMartinLewisAgar = growthOnMartinLewisAgar;
            dto.Oxidase = oxidaseTestResult;

            var validationResult = Validate(dto);

            AssertIsValid(validationResult);
        }
Exemplo n.º 13
0
 public override void Init(LogicPlayground logicPlayground, int _x, int _y, LogicJack _owner, Growth _growth = Growth.Small)
 {
     base.Init(logicPlayground, _x, _y, _owner, _growth);
     logicPlayground.onTurnChange += GiveBonusAc;
     type = TreeType.BonusAc;
 }
        public SpriteHolder GetSprite(InstalledItem item)
        {
            SpriteHolder sp = new SpriteHolder();

            if (item.growthStage >= 0)
            {
                Growth g = item.growthStages[item.growthStage];
                sp.s = GetSprite(g.sprite);
            }
            else
            {
                sp.s = GetSprite(item.getRandomSpriteName());
            }



            if (item.randomRotation)
            {
                int r = Random.Range(0, 4);
                sp.r = 90 * r;
            }



            if (item.linksToNeighbour)
            {
                int  x = item.tile.world_x;
                int  y = item.tile.world_y;
                bool northMatches, eastMatches, southMatches, westMatches;
                int  countOfNeighbours = 0;
                //Dictionary<string, Tile> ngbrs = WorldController.Instance.world.GetNeighbours(item);
                Tile north             = item.tile.GetNeighbour(World.NORTH);
                Tile east              = item.tile.GetNeighbour(World.EAST);
                Tile south             = item.tile.GetNeighbour(World.SOUTH);
                Tile west              = item.tile.GetNeighbour(World.WEST);

                northMatches = hasMatchingNeighbour(north, item);
                if (northMatches)
                {
                    countOfNeighbours += 1;
                }
                eastMatches = hasMatchingNeighbour(east, item);
                if (eastMatches)
                {
                    countOfNeighbours += 1;
                }
                southMatches = hasMatchingNeighbour(south, item);
                if (southMatches)
                {
                    countOfNeighbours += 1;
                }
                westMatches = hasMatchingNeighbour(west, item);
                if (westMatches)
                {
                    countOfNeighbours += 1;
                }

                switch (countOfNeighbours)
                {
                case 0:

                    break;

                case 1:
                    sp.s = GetSprite(item.sprite_s);
                    if (northMatches)
                    {
                        sp.r = 180;
                    }
                    else if (eastMatches)
                    {
                        sp.r = 90;
                    }
                    else if (westMatches)
                    {
                        sp.r = -90;
                    }
                    break;

                case 2:
                    sp.s = GetSprite(item.sprite_ns);
                    if (eastMatches && westMatches)
                    {
                        sp.r = 90;
                    }
                    else if (northMatches && southMatches)
                    {
                        sp.r = 0;
                    }
                    else
                    {
                        sp.s = GetSprite(item.sprite_sw);
                        if (southMatches && westMatches)
                        {
                        }
                        else if (northMatches && eastMatches)
                        {
                            sp.r = -180;
                        }
                        else if (northMatches && westMatches)
                        {
                            sp.r = -90;
                        }
                        else if (eastMatches && southMatches)
                        {
                            sp.r = 90;
                        }
                    }
                    break;

                case 3:
                    sp.s = GetSprite(item.sprite_nsw);

                    if (northMatches && southMatches && westMatches)
                    {
                    }
                    else if (northMatches && eastMatches && westMatches)
                    {
                        sp.r = -90;
                    }
                    else if (eastMatches && southMatches && westMatches)
                    {
                        sp.r = 90;
                    }
                    else if (northMatches && eastMatches && southMatches)
                    {
                        sp.r = 180;
                    }

                    break;

                case 4:
                    sp.s = GetSprite(item.sprite_nesw);
                    break;
                }
            }
            else
            {
            }
            return(sp);
        }
Exemplo n.º 15
0
 virtual public void Init(LogicPlayground logicPlayground, int _x, int _y, LogicJack _owner, Growth _growth = Growth.Small)
 {
     x      = _x;
     y      = _y;
     growth = _growth;
     owner  = _owner;
 }
Exemplo n.º 16
0
        private static bool OtherTypingFieldsBesidesSerogroupPcrAreEmptyIfNoGrowth(MeningoIsolateViewModel model, Growth growth)
        {
            var noGrowthAtAll  = model.GrowthOnBloodAgar == Growth.No && model.GrowthOnMartinLewisAgar == Growth.No;
            var anyTestingDone =
                model.Oxidase != TestResult.NotDetermined || model.Agglutination != MeningoSerogroupAgg.NotDetermined ||
                model.Onpg != TestResult.NotDetermined || model.GammaGt != TestResult.NotDetermined ||
                model.MaldiTof != UnspecificTestResult.NotDetermined;
            var modelIsInvalid = noGrowthAtAll && anyTestingDone;

            return(!modelIsInvalid);
        }
Exemplo n.º 17
0
 public override void Init(LogicPlayground logicPlayground, int _x, int _y, LogicJack _owner, Growth _growth = Growth.Small)
 {
     base.Init(logicPlayground, _x, _y, _owner, _growth);
     type = TreeType.Basic;
 }
Exemplo n.º 18
0
 public override void Init(LogicPlayground logicPlayground, int _x, int _y, LogicJack _owner, Growth _growth = Growth.Small)
 {
     base.Init(logicPlayground, _x, _y, _owner, _growth);
     logicPlayground.onPlayerTryMove += MakeThemMoveHarder;
     type = TreeType.Swamp;
 }
Exemplo n.º 19
0
 private bool IsGrowthOwner(Growth growth) => growth.Infant.UserId == userManager.GetUserId(User);
    // Use to process your families.
    protected override void onProcess(int familiesUpdateCount)
    {
        foreach (GameObject go in _factoryGO)
        {
            Transform tr        = go.GetComponent <Transform>();
            Factory[] factories = go.GetComponents <Factory>();

            foreach (Factory factory in factories)
            {
                factory.reloadProgress += Time.deltaTime;

                if (factory.reloadProgress >= factory.reloadTime)
                {
                    //Instantiate and bind to FYFY a new instance of antibodies drift (factory prefab)
                    Vector3 spawnPos = tr.position;
                    spawnPos.z += 1;
                    GameObject mySpawn = Object.Instantiate <GameObject>(factory.prefab, spawnPos, Quaternion.Euler(0f, 0f, Random.Range(0f, 360f)));
                    GameObjectManager.bind(mySpawn);

                    //Set some parameters of the antibodies drift
                    Growth gr = mySpawn.GetComponent <Growth>();
                    if (gr != null)
                    {
                        mySpawn.GetComponent <Growth>().baseSize = tr.localScale.x * 0.5f;
                        float f = mySpawn.GetComponent <Growth>().baseSize;
                    }

                    //Object spawned get predator values of parent (if both have the component)
                    Predator predatorFactory = go.GetComponent <Predator>();
                    Predator predatorSpawn   = mySpawn.GetComponent <Predator>();

                    if (predatorFactory != null && predatorSpawn != null)
                    {
                        predatorSpawn.myPreys = predatorFactory.myPreys;
                    }

                    //Reinit factory if object spawned have a factory
                    Factory[] spawnFactories = mySpawn.GetComponents <Factory>();
                    foreach (Factory spawnFactory in spawnFactories)
                    {
                        spawnFactory.reloadProgress = 0f;
                    }

                    Move mv = mySpawn.GetComponent <Move>();
                    if (mv != null)
                    {
                        Vector2 posTarget = new Vector2(Random.Range(tr.position.x - 1f, tr.position.x + 1f), Random.Range(tr.position.y - 1f, tr.position.y - 1f));

                        mv.targetPosition    = posTarget;
                        mv.targetObject      = null;
                        mv.newTargetPosition = true;
                        mv.forcedTarget      = true;
                    }

                    /*
                     * WARNING: should not do that but looks like that even if instance come frome a prefab, it is instanciated with a Triggered2D...
                     * Looks like to come from cases where an GO store it's own prefab, but instead store himself,
                     * so we don't instantiate a prefab but a copy of the object
                     *
                     * If this line is commented, FYFY will generate an error
                     */
                    Object.Destroy(mySpawn.GetComponent <Triggered2D>());

                    //mySpawn.GetComponent<Transform>().localScale = new Vector3(0f, 0f, 0f);
                    //mySpawn.SetActive(true);

                    factory.reloadProgress = 0f;
                }
            }
        }
    }
Exemplo n.º 21
0
        private void DrawContentBox(Growth growth)
        {
            var bar = EditorGUILayout.GetControlRect(GUILayout.MinHeight(80),
                                                     GUILayout.MaxHeight(150));
            var areaRect = bar;

            var array = growth.CachedValues.ToArray();

            Array.Resize(ref array, growth.MaxLevel);

            growth.CachedValues = array.ToList();
            if (growth.CachedValues.Count < growth.MaxLevel)
            {
                growth.CachedValues.Capacity = growth.MaxLevel;
            }

            var lightColor = m_color;

            lightColor.a = 0.1f;

            GUI.color = lightColor;
            GUI.Box(bar, "", m_editorStyle);

            var selection = DrawBarByMouse(growth, areaRect, out var value);

            SetByCurve(growth);

            ApplyValueToBar(growth, selection, value);


            bar.y     += bar.height;
            bar.width /= growth.MaxLevel;
            bar.width -= 1;

            lightColor.a = 0.5f;
            GUI.color    = lightColor;

            for (var i = 0; i < growth.MaxLevel; i++)
            {
                var p = Mathf.InverseLerp(growth.MinValue, growth.MaxValue,
                                          growth.CachedValues[i]);
                bar.height = Mathf.Lerp(0, -areaRect.height, p);

                var color = GUI.color;


                if (growth.CachedValues.Count >= i)
                {
                    if (selection >= 0 && selection == i)
                    {
                        GUI.color += new Color(0, 0, 0, 1);
                    }


                    GUI.Box(bar, "", m_editorStyle);

                    GUI.color  = color;
                    GUI.color += new Color(0.4f, 0.4f, 0.4f, 0f);
                    if (selection >= 0 && selection == i)
                    {
                        GUI.color += new Color(0, 0, 0, 1);
                    }

                    var style = new GUIStyle()
                                .FontStyle(FontStyle.Bold)
                                .FontSize(6);

                    GUI.Label(new Rect(bar.x, bar.y - 14, 5, 30), growth.CachedValues[i] + "",
                              style);
                }

                bar.x += bar.width + 1;

                Window.Repaint();
                GUI.color = color;
            }


            var rect = areaRect;

            rect.y += 2;
            rect.x += 10;

            if (selection >= 0)
            {
                GUI.Label(rect, $"Level: {(selection + 1)}", RpgEditorStyles.TitleStyle);
            }

            rect.y += 12;

            if (selection >= 0)
            {
                GUI.Label(rect,
                          $"Amount: {growth.CachedValues[selection]}", RpgEditorStyles.TitleStyle);
            }


            GUI.color = Color.white;
        }