How to set Specialization in script?

More
6 years 8 months ago #2859 by thierry258
Everything is in the title :lol:

I want to know how to set current spcialization in use, manually?

Thanks in advance for your answer.

I'm using Version 2.8.4.f1

Please Log in or Create an account to join the conversation.

More
6 years 8 months ago #2861 by Frank
Hi,
I'm still writing the doc on this new feature, thanks for remind me to go FINISH it!!!

To add and manage specializations, you just need to add an script like this in your game:
using System;
using UnityEngine;
using System.Linq;

namespace I2.Loc
{
    public partial class SpecializationManager
    {
        public override void InitializeSpecializations()
        {
            base.InitializeSpecializations();

            mSpecializations = mSpecializations.Concat(new string[] {
                "Console1",
                "Console2"
            }).ToArray();

            mSpecializationsFallbacks["Console1"] = "Controller";
            mSpecializationsFallbacks["Console2"] = "Controller";
        }

        public override string GetCurrentSpecialization()
        {
            if (Input.touchSupported)
                return "Touch";
            else
                return base.GetCurrentSpecialization();
        }
    }
}

In the InitializeSpecializations you can add or remove specializations from the mSpecializations array (the example adds two new ones).
And also set a fallback to them, (e.g. "Console1" is also a "Controller"), meaning that if the current specialization is "Controller", then everything tag as "Console1" will also be used.

then, in the GetCurrentSpecialization you can select which one is the current specialization.

That script can be placed outside the I2 folder, so that when you need to update, you can delete the I2 folder and install the new I2L version without loosing those changes.

Hope that helps,
Frank

Are you :-) Give I2L 5 stars!
Are you :-( Please lets us know how to improve it!
To get the betas as soon as they are ready, check this out
The following user(s) said Thank You: studenman

Please Log in or Create an account to join the conversation.

Time to create page: 0.139 seconds
Template by JoomlaShine