예제 #1
0
 public override bool SetComponentData(UrbComponentData Data)
 {
     GoalTag         = UrbEncoder.GetEnum <UrbScentTag>("GoalTag", Data);
     PassableTerrain = UrbEncoder.GetEnum <UrbPathTerrain>("PassableTerrain", Data);
     Size            = (int)UrbEncoder.GetField("Size", Data);
     return(true);
 }
 public static bool CheckScent(UrbSubstanceTag Substance, UrbScentTag Scent)
 {
     if (SubstanceByScent.ContainsKey(Scent))
     {
         return(SubstanceByScent[Scent].Contains(Substance));
     }
     return(false);
 }
    protected static bool UnregisterScent(UrbSubstanceTag Substance, UrbScentTag Scent)
    {
        if (SubstanceByScent.ContainsKey(Scent))
        {
            if (SubstanceByScent[Scent].Contains(Substance))
            {
                return(SubstanceByScent[Scent].Remove(Substance));
            }
        }

        return(false);
    }
    protected static bool RegisterScent(UrbSubstanceTag Substance, UrbScentTag Scent)
    {
        if (!SubstanceByScent.ContainsKey(Scent))
        {
            SubstanceByScent.Add(Scent, new List <UrbSubstanceTag>());
        }

        if (SubstanceByScent[Scent].Contains(Substance))
        {
            return(false);
        }

        SubstanceByScent[Scent].Add(Substance);

        return(true);
    }
예제 #5
0
    public void DetractScent(UrbScentTag tag, float value = 0.0f)
    {
        var idx = ScentIndexes.IndexOf(tag);

        if (idx < 0)
        {
            return;
        }

        var newVal = Values[idx] = value;

        if (newVal < 0)
        {
            newVal = 0.0f;
        }

        Values[idx] = newVal;
    }
예제 #6
0
    public void AddScent(UrbScentTag tag, float value)
    {
        if (value > 0)
        {
            HasScents = true;
        }

        var idx = ScentIndexes.IndexOf(tag);

        if (idx < 0)
        {
            ScentIndexes.Add(tag);
            Values.Add(value);
            return;
        }

        Values[idx] += value;
    }
예제 #7
0
 public float this[UrbScentTag i] {
     get { return(this[(int)i]); }
     set { this[(int)i] = value; }
 }
예제 #8
0
 public static bool SubstanceSmellsLike(UrbSubstanceTag Substance, UrbScentTag Scent)
 {
     return(UrbSubstanceProperties.CheckScent(Substance, Scent));
 }