Pack (Operating title) [ ARPG + Creature collection ]

[ad_1]

Properly this week I am sort of frustrated simply because seemingly basic points took me fairly an work, but at times that is just the way points are.

I have been operating on a transition to showcase when the creatures morph (evolve in pokemon lingo). I wanted to isolate the creature from the atmosphere by creating every thing but the creature itself fade away and position it in the middle of the screen.

Because I am not extremely very good with shaders, I had to use sort of a hack. It includes modifying a widespread approach to fade in and out to a strong colour or image.

Preparations:
1- Generate a single layer for what ever you want to isolate.
two- Make principal camera show that layer.
three- Generate two new cameras that will show only that layer.
four- Generate a render texture and assign it to a single of the new cameras.
five- Generate a gui texture (make positive it is painted more than all other UI) and show the render texture there.

On runtime:
1- Activate each the render texture gui (with a zero alpha colour multiplier) and the render texture camera.
two- Lerp that alpha till it reached total opacity.
three- Deactivate the render texture and the render texture camera, activate the other camera that only renders the new layer.

Smaller variations can be produced (alternatively of applying a third camera at the finish, just modify the layer mask of your principal camera, and so forth) but you get the notion: Use the alpha of a render texture to gradually transition from a camera with most layers to other with other flags.

Also I lost a lot of time attempting to make a drawer for a dictionary (unity inspector does not assistance these). I ultimately gave up and just developed a class with a list of structs (the structs had been complised of the essential field and the worth field). Then I developed all functions and operators to make it function like a dictionary.

[System.Serializable]
public class EssenceValue
{
    public Species species
    public int quantity

    public EssenceValue( Species define_species, int define_quantity = )
    {
        species = define_species ?? throw new Method.ArgumentNullException(“The species is employed as an index and as such can not be null”)
        quantity = define_quantity
    }
}

//
// The complete class is a list wrapped as a dictionary so it seems in the inspector
//
[System.Serializable]
public class EssenceInventory
{
    [SerializeField]
    private List&ltEssenceValue&gt essences = new List&ltEssenceValue&gt()

    public int this[Species speciesIndex]
    {
        get { return essences.Obtain(x =&gt x.species == speciesIndex).quantity }
        set
        {
            for (int i = i &lt essences.Count i++)
            {
                if (essences[i].species == speciesIndex)
                {
                    essences[i].quantity = worth
                    return
                }
            }
            throw new Method.IndexOutOfRangeException( “The species employed as essence essential was not identified on the list of essences of the inventory” )
        }
    }

    public void Clear()
    {
        essences.Clear()
    }

    public void Add ( Species species, int quantity )
    {
        if ( ContainsKey(species) )
        {
            throw new Method.ArgumentException(“Essence kind currently exists in the inventory”)
        }
        else
        {
            EssenceValue newEssenceValue = new EssenceValue(species, quantity)
            essences.Add(newEssenceValue)
        }
    }

    public bool Eliminate( Species speciesToRemove )
    {
        return essences.Eliminate(essences.Obtain(x =&gt x.species == speciesToRemove))
    }

    public bool ContainsKey( Species species )
    {
        EssenceValue foundEssence = essences.Obtain( x =&gt x.species == species )

        return (foundEssence != null)
    }
}

I could possibly turn it into a template to use with distinctive kinds in the future.

[ad_2]

Latest posts