Exemple #1
0
 // Some prototype function for dampening influence
 private float influenceDampener(float influence, int hpDifference, int distance, InfluenceType influenceType)
 {
     if (distance > maxDampeningDistance)
     {
         return(0.0f);
     }
     return((1.0f + (float)hpDifference / 6.0f) * influence / distance);
 }
        public void ParseShouldParseInfluence(InfluenceType expected)
        {
            string[] itemStringLines = this.itemStringBuilder
                                       .WithInflucence(expected)
                                       .BuildLines();

            EquippableItem result = this.ItemParser.Parse(itemStringLines) as EquippableItem;

            Assert.That(result.Influence, Is.EqualTo(expected));
        }
Exemple #3
0
        public bool HasInfluenceOfType(InfluenceType type)
        {
            foreach (var influence in Influences)
            {
                if (influence.Key == type)
                {
                    return(true);
                }
            }

            return(false);
        }
Exemple #4
0
        /// <summary>
        /// Get the influence of a given type if exists
        /// </summary>
        /// <param name="type">The influence type</param>
        /// <returns>The value of the influence given the type or -1 if the type doesn't exists</returns>
        public KeyValuePair <InfluenceType, float> GetInfluenceOfType(InfluenceType type)
        {
            foreach (var influence in Influences)
            {
                if (influence.Key == type)
                {
                    return(new KeyValuePair <InfluenceType, float>(influence.Key, influence.Value));
                }
            }

            return(new KeyValuePair <InfluenceType, float>(0, -1));
        }
Exemple #5
0
        public float GetTotalInfluenceAtNodeWithFilter(InfluenceType type = InfluenceType.Core)
        {
            float result = 0;

            foreach (var influence in Influences)
            {
                if (influence.Key != type)
                {
                    result += influence.Value;
                }
            }

            return(result);
        }
        public void MapQueryItemShouldMapInfluence(InfluenceType influenceType, BoolOptionAccessor filterOptionAccessor)
        {
            var item = new EquippableItem(ItemRarity.Normal)
            {
                Influence = influenceType
            };

            SearchQueryRequest result = this.equippableItemToQueryRequestMapper.MapToQueryRequest(item) as SearchQueryRequest;

            BoolOptionFilter filter = filterOptionAccessor(result);

            Assert.That(filter, Is.Not.Null);
            Assert.That(filter.Option, Is.True);
        }
Exemple #7
0
    public InfluenceMap(InfluenceType type, List <Region> regions, InfluenceMapManager influenceMapManager, float momentum, float decay)
    {
        MapType = type;

        Regions             = regions;
        InfluencesValues    = new float[Regions.Count];
        tempInfluenceValues = new float[Regions.Count];

        influenceSources = new List <InfluenceSource>();

        this.influenceMapManager = influenceMapManager;

        this.momentum = momentum;
        this.decay    = decay;
    }
    public void tryInfluence(InfluenceType type)
    {
        float baseTestInfluence = 10f; // chiffre de base d'augmentation a revoir

        int random = Random.Range(0, 101);

        float luckRate = 1;

        //Echec critique
        if (random < 5)
        {
            luckRate = -1;
        }
        //Succes critique
        else if (random > 95)
        {
            luckRate = 2;
        }

        switch (type)
        {
        case InfluenceType.RAIN:
            influence += baseTestInfluence * luckRate * factorRain;
            break;

        case InfluenceType.SUN:
            influence += baseTestInfluence * luckRate * factorSun;
            break;

        default:
            break;
        }
        if (influence > 0)
        {
            influenceBar.SetActive(true);
        }

        if (influence >= influenceMax && att.numPlayer == -1)
        {
            att.numPlayer = 1;
            Debug.Log("Une créature est maintenant sous votre influence !  : " + att.name);
            influence = 0;
            influenceBar.SetActive(false);
            //Mettre en place le système de possession

            GameObject.Find("Player").GetComponent <Player>().addCreature(gameObject);
        }
    }
Exemple #9
0
    public PuzzleCell(PlantType p, InfluenceType i, PlantType[] toGrow = null)
    {
        influenced = i;
        plants     = p;

        if (p == PlantType.C)
        {
            plantsToGrow  = new List <PlantType>();
            progressToWin = new List <PlantType>();
            showBroto     = false;

            for (int c = 0; c < toGrow.Length; c++)
            {
                Debug.Log("Adicionou");
                plantsToGrow.Add(toGrow[c]);
            }
        }
    }
Exemple #10
0
    public void UpdateInfluenceVisualization(InfluenceType mapType)
    {
        if (isVisualizingInfluence)
        {
            if (mapType == InfluenceType.Population)
            {
                for (int i = 0; i < regionCount; i++)
                {
                    float influenceValue = PopulationMap.InfluencesValues[i];
                    Color newColor       = Color.Lerp(minInfluenceColor, maxInfluenceColor, influenceValue);
                    regions[i].ModifyUI_Color(newColor);

                    int decimalValueIndex = Mathf.RoundToInt(influenceValue * 100);
                    regions[i].ModifyUI_Text(decimalValues[decimalValueIndex]);
                }
            }
        }
    }
Exemple #11
0
    //This is a probability, so a 0.20f reduction would reduce some previous risk from 0.05 to 0.04
    public float getInfluence(InfluenceType influenceType)
    {
        switch (influenceType)
        {
        case InfluenceType.stabilization:
        {
            float reduction = 0.25f;
            if (building == Board.Building.Stabilizer)
            {
                reduction += 0.9f;
            }
            return(reduction);
        }

        case InfluenceType.gold:
        case InfluenceType.iron:
        {
            if (building == Board.Building.Mine)
            {
                // Gather tilesWithinDistance(1) for houses and gather house influence
                float houseEffect = 0f;
                foreach (KeyValuePair <Tile, int> entry in tilesWithinDistance(1))
                {
                    houseEffect += entry.Key.getInfluence(InfluenceType.mine);
                }
                return(1.0f + houseEffect);
            }
            else if (building == Board.Building.Mine2)
            {
                // Gather tilesWithinDistance(1) for houses and gather house influence
                float houseEffect = 0f;
                foreach (KeyValuePair <Tile, int> entry in tilesWithinDistance(1))
                {
                    houseEffect += entry.Key.getInfluence(InfluenceType.mine);
                }
                return(2.0f + 2.0f * houseEffect);
            }
            return(0.0f);
        }

        case InfluenceType.coal:
        {
            if (building == Board.Building.Mine)
            {
                // Gather tilesWithinDistance(1) for houses and gather house influence
                float houseEffect = 0f;
                foreach (KeyValuePair <Tile, int> entry in tilesWithinDistance(1))
                {
                    houseEffect += entry.Key.getInfluence(InfluenceType.mine);
                }
                return(1.0f + houseEffect);
            }
            else if (building == Board.Building.Mine2)
            {
                // Gather tilesWithinDistance(1) for houses and gather house influence
                float houseEffect = 0f;
                foreach (KeyValuePair <Tile, int> entry in tilesWithinDistance(1))
                {
                    houseEffect += entry.Key.getInfluence(InfluenceType.mine);
                }
                return(2.0f + 2.0f * houseEffect);
            }
            return(0.0f);
        }

        case InfluenceType.wood: {
            if (building == Board.Building.Saw)
            {
                // Gather tilesWithinDistance(1) for houses and gather house influence
                float houseEffect = 0f;
                foreach (KeyValuePair <Tile, int> entry in tilesWithinDistance(1))
                {
                    houseEffect += entry.Key.getInfluence(InfluenceType.saw);
                }
                return(1.0f + houseEffect);
            }
            else if (building == Board.Building.Saw2)
            {
                // Gather tilesWithinDistance(1) for houses and gather house influence
                float houseEffect = 0f;
                foreach (KeyValuePair <Tile, int> entry in tilesWithinDistance(1))
                {
                    houseEffect += entry.Key.getInfluence(InfluenceType.saw);
                }
                return(2.0f + 2.0f * houseEffect);
            }
            return(0.0f);
        }

        case InfluenceType.mine: {
            if (building == Board.Building.House)
            {
                return(0.5f);
            }
            else if (building == Board.Building.House2)
            {
                return(1.0f);
            }
            return(0.0f);
        }

        case InfluenceType.saw:
        {
            if (building == Board.Building.House)
            {
                return(0.5f);
            }
            return(0.0f);
        }
        }
        throw new Exception("Bad InfluenceType for getting tile influence");
    }
Exemple #12
0
        static void Gizmos_InfluenceFade(ReflectionProbe p, HDAdditionalReflectionData a, HDReflectionProbeEditor e, InfluenceType type, bool isEdit)
        {
            var col = Gizmos.color;
            var mat = Gizmos.matrix;

            Gizmo6FacesBoxContained box;
            Vector3 boxCenterOffset;
            Vector3 boxSizeOffset;
            float   sphereRadiusOffset;
            Color   color;

            switch (type)
            {
            default:
            case InfluenceType.Standard:
            {
                box                = e != null ? e.m_UIState.alternativeBoxBlendHandle : null;
                boxCenterOffset    = a.boxBlendCenterOffset;
                boxSizeOffset      = a.boxBlendSizeOffset;
                sphereRadiusOffset = a.sphereBlendRadiusOffset;
                color              = isEdit ? k_GizmoThemeColorInfluenceBlendFace : k_GizmoThemeColorInfluenceBlend;
                break;
            }

            case InfluenceType.Normal:
            {
                box                = e != null ? e.m_UIState.alternativeBoxBlendNormalHandle : null;
                boxCenterOffset    = a.boxBlendNormalCenterOffset;
                boxSizeOffset      = a.boxBlendNormalSizeOffset;
                sphereRadiusOffset = a.sphereBlendNormalRadiusOffset;
                color              = isEdit ? k_GizmoThemeColorInfluenceNormalBlendFace : k_GizmoThemeColorInfluenceNormalBlend;
                break;
            }
            }

            Gizmos.matrix = HDReflectionProbeEditorUtility.GetLocalSpace(p);
            switch (a.influenceShape)
            {
            case ShapeType.Box:
            {
                Gizmos.color = color;
                if (e != null)         // e == null may occure when editor have still not been created at selection while the tool is not used for this part
                {
                    box.DrawHull(isEdit);
                }
                else
                {
                    if (isEdit)
                    {
                        Gizmos.DrawCube(p.center + boxCenterOffset, p.size + boxSizeOffset);
                    }
                    else
                    {
                        Gizmos.DrawWireCube(p.center + boxCenterOffset, p.size + boxSizeOffset);
                    }
                }
                break;
            }

            case ShapeType.Sphere:
            {
                Gizmos.color = color;
                if (isEdit)
                {
                    Gizmos.DrawSphere(p.center, a.influenceSphereRadius + sphereRadiusOffset);
                }
                else
                {
                    Gizmos.DrawWireSphere(p.center, a.influenceSphereRadius + sphereRadiusOffset);
                }
                break;
            }
            }

            Gizmos.matrix = mat;
            Gizmos.color  = col;
        }
Exemple #13
0
        static void Handle_InfluenceFadeEditing(HDReflectionProbeUI s, SerializedHDReflectionProbe sp, Editor o, InfluenceType influenceType)
        {
            BoxBoundsHandle    blendBox;
            SphereBoundsHandle sphereHandle;
            Vector3            probeBlendDistancePositive, probeBlendDistanceNegative;
            Color color;

            switch (influenceType)
            {
            default:
            case InfluenceType.Standard:
            {
                blendBox     = s.boxBlendHandle;
                sphereHandle = s.sphereBlendHandle;
                probeBlendDistancePositive = sp.targetData.blendDistancePositive;
                probeBlendDistanceNegative = sp.targetData.blendDistanceNegative;
                color = k_GizmoThemeColorInfluenceBlend;
                break;
            }

            case InfluenceType.Normal:
            {
                blendBox     = s.boxBlendNormalHandle;
                sphereHandle = s.sphereBlendNormalHandle;
                probeBlendDistancePositive = sp.targetData.blendNormalDistancePositive;
                probeBlendDistanceNegative = sp.targetData.blendNormalDistanceNegative;
                color = k_GizmoThemeColorInfluenceNormalBlend;
                break;
            }
            }


            var mat = Handles.matrix;
            var col = Handles.color;

            Handles.matrix = HDReflectionProbeEditorUtility.GetLocalSpace(sp.target);
            switch ((ReflectionInfluenceShape)sp.influenceShape.enumValueIndex)
            {
            case ReflectionInfluenceShape.Box:
            {
                blendBox.center = sp.target.center - (probeBlendDistancePositive - probeBlendDistanceNegative) * 0.5f;
                blendBox.size   = sp.target.size - probeBlendDistancePositive - probeBlendDistanceNegative;

                Handles.color = k_GizmoThemeColorExtent;
                EditorGUI.BeginChangeCheck();
                Handles.color = color;
                blendBox.DrawHandle();
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(sp.target, "Modified Reflection Probe Influence");
                    Undo.RecordObject(sp.targetData, "Modified Reflection Probe Influence");

                    var center        = sp.target.center;
                    var influenceSize = sp.target.size;

                    var diff     = 2 * (blendBox.center - center);
                    var sum      = influenceSize - blendBox.size;
                    var positive = (sum - diff) * 0.5f;
                    var negative = (sum + diff) * 0.5f;
                    var blendDistancePositive = Vector3.Max(Vector3.zero, Vector3.Min(positive, influenceSize));
                    var blendDistanceNegative = Vector3.Max(Vector3.zero, Vector3.Min(negative, influenceSize));

                    probeBlendDistancePositive = blendDistancePositive;
                    probeBlendDistanceNegative = blendDistanceNegative;

                    ApplyConstraintsOnTargets(s, sp, o);

                    EditorUtility.SetDirty(sp.target);
                    EditorUtility.SetDirty(sp.targetData);
                }
                break;
            }

            case ReflectionInfluenceShape.Sphere:
            {
                sphereHandle.center = sp.target.center;
                sphereHandle.radius = Mathf.Clamp(sp.targetData.influenceSphereRadius - probeBlendDistancePositive.x, 0, sp.targetData.influenceSphereRadius);

                Handles.color = k_GizmoThemeColorExtent;
                EditorGUI.BeginChangeCheck();
                Handles.color = color;
                sphereHandle.DrawHandle();
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(sp.target, "Modified Reflection influence volume");
                    Undo.RecordObject(sp.targetData, "Modified Reflection influence volume");

                    var influenceRadius = sp.targetData.influenceSphereRadius;
                    var blendRadius     = sphereHandle.radius;

                    var blendDistance = Mathf.Clamp(influenceRadius - blendRadius, 0, influenceRadius);

                    probeBlendDistancePositive = Vector3.one * blendDistance;
                    probeBlendDistanceNegative = probeBlendDistancePositive;

                    ApplyConstraintsOnTargets(s, sp, o);

                    EditorUtility.SetDirty(sp.target);
                    EditorUtility.SetDirty(sp.targetData);
                }
                break;
            }
            }
            Handles.matrix = mat;
            Handles.color  = col;


            switch (influenceType)
            {
            default:
            case InfluenceType.Standard:
            {
                sp.targetData.blendDistancePositive = probeBlendDistancePositive;
                sp.targetData.blendDistanceNegative = probeBlendDistanceNegative;
                break;
            }

            case InfluenceType.Normal:
            {
                sp.targetData.blendNormalDistancePositive = probeBlendDistancePositive;
                sp.targetData.blendNormalDistanceNegative = probeBlendDistanceNegative;
                break;
            }
            }
        }
Exemple #14
0
        static void Gizmos_InfluenceFade(ReflectionProbe p, HDAdditionalReflectionData a, Editor e, InfluenceType type, bool isEdit)
        {
            var col = Gizmos.color;
            var mat = Gizmos.matrix;

            Vector3 boxCenterOffset;
            Vector3 boxSizeOffset;
            float   sphereRadiusOffset;
            Color   color;

            switch (type)
            {
            default:
            case InfluenceType.Standard:
            {
                boxCenterOffset    = a.boxBlendCenterOffset;
                boxSizeOffset      = a.boxBlendSizeOffset;
                sphereRadiusOffset = a.sphereBlendRadiusOffset;
                color = isEdit ? k_GizmoThemeColorInfluenceBlendFace : k_GizmoThemeColorInfluenceBlend;
                break;
            }

            case InfluenceType.Normal:
            {
                boxCenterOffset    = a.boxBlendNormalCenterOffset;
                boxSizeOffset      = a.boxBlendNormalSizeOffset;
                sphereRadiusOffset = a.sphereBlendNormalRadiusOffset;
                color = isEdit ? k_GizmoThemeColorInfluenceNormalBlendFace : k_GizmoThemeColorInfluenceNormalBlend;
                break;
            }
            }

            Gizmos.matrix = HDReflectionProbeEditorUtility.GetLocalSpace(p);
            switch (a.influenceShape)
            {
            case ReflectionInfluenceShape.Box:
            {
                Gizmos.color = color;
                if (isEdit)
                {
                    Gizmos.DrawCube(p.center + boxCenterOffset, p.size + boxSizeOffset);
                }
                else
                {
                    Gizmos.DrawWireCube(p.center + boxCenterOffset, p.size + boxSizeOffset);
                }
                break;
            }

            case ReflectionInfluenceShape.Sphere:
            {
                Gizmos.color = color;
                if (isEdit)
                {
                    Gizmos.DrawSphere(p.center, a.influenceSphereRadius + sphereRadiusOffset);
                }
                else
                {
                    Gizmos.DrawWireSphere(p.center, a.influenceSphereRadius + sphereRadiusOffset);
                }
                break;
            }
            }

            Gizmos.matrix = mat;
            Gizmos.color  = col;
        }
 public HistoricEventInfluence(InfluenceType type, double value, DateTime endDate)
 {
     this.Type    = type;
     this.EndDate = endDate;
     this.Value   = value;
 }
Exemple #16
0
 public void setPowerSelection(InfluenceType type)
 {
     inSelection      = true;
     inSelectionPower = true;
     influType        = type;
 }
Exemple #17
0
        public void CreateShouldReturnInfluenceFilterViewModel(Expression <Func <SearchQueryRequest, IFilter> > expectedBindingExpression, InfluenceType influenceType)
        {
            // arrange
            var equippableItem = new EquippableItem(ItemRarity.Unique)
            {
                Influence = influenceType
            };

            // act & assert
            this.CreateShouldReturnBindableFilterViewModel(expectedBindingExpression, equippableItem, null, equippableItem.Influence.GetDisplayName());
        }
Exemple #18
0
 public ItemStringBuilder WithInflucence(InfluenceType influence)
 {
     this.InfluenceType = influence;
     return(this);
 }
 public HistoricEventInfluence(InfluenceType type, double value, DateTime endDate)
 {
     this.Type = type;
     this.EndDate = endDate;
     this.Value = value;
 }
Exemple #20
0
        public void CreateShouldReturnInfluenceFilterViewModelWithValueFromSearchQueryRequest(Expression <Func <SearchQueryRequest, IFilter> > expectedBindingExpression, InfluenceType influenceType)
        {
            // arrange
            var equippableItem = new EquippableItem(ItemRarity.Unique)
            {
                Influence = influenceType
            };

            var queryRequestFilter = new BoolOptionFilter
            {
                Option = true
            };

            // act & assert
            this.CreateShouldReturnBindableFilterViewModelWithValueFromQueryRequest(expectedBindingExpression, equippableItem, equippableItem.Influence.GetDisplayName(), queryRequestFilter);
        }