Esempio n. 1
0
    public void Bind(Animator anim, string parameterName)
    {
        animator           = anim;
        this.parameterName = parameterName;
        AnimatorParameterSetter[] setters = animator.GetComponents <AnimatorParameterSetter>();
        bool found = false;

        foreach (AnimatorParameterSetter parameter2 in setters)
        {
            if (parameter2.parameterName == parameterName)
            {
                parameter = parameter2;
                found     = true;
                break;
            }
        }
        if (!found)
        {
            foreach (AnimatorControllerParameter p in animator.parameters)
            {
                if (p.name == parameterName)
                {
                    parameter = animator.gameObject.AddComponent <AnimatorParameterSetter>();
                    parameter.parameterName = parameterName;
                    break;
                }
            }
        }
        if (parameter != null)
        {
            parameter.input = channel;
        }
    }
Esempio n. 2
0
    void Start()
    {
        animations = new List <IAnimationExecutor>();

        var mapGameObject     = transform.Find("Map").gameObject;
        var wolfCupcakeObject = transform.Find("WolfCupcake").gameObject;

        var mapDisappear      = new AnimatorParameterSetter <bool>(mapGameObject.GetComponent <Animator>(), "IsDisappear", true, 9.0f, null);
        var cupcakeAppear     = new AnimatorParameterSetter <bool>(wolfCupcakeObject.GetComponent <Animator>(), "IsShowCupcake", true, 10.0f, null);
        var showCupcakeRecipe = new AnimatorParameterSetter <bool>(wolfCupcakeObject.GetComponent <Animator>(), "IsShowRecipe", true, 11.0f, null);
        var wolfAppear        = new AnimatorParameterSetter <bool>(wolfCupcakeObject.GetComponent <Animator>(), "IsShowWolf", true, 17.0f, null);
        var showWolfDna       = new AnimatorParameterSetter <bool>(wolfCupcakeObject.GetComponent <Animator>(), "IsShowNucleotides", true, 18.0f, null);
        var color             = new AnimatorParameterSetter <bool>(wolfCupcakeObject.GetComponent <Animator>(), "IsColor", true, 28.5f, null);
        var showDna           = new AnimatorParameterSetter <bool>(wolfCupcakeObject.GetComponent <Animator>(), "IsShowDna", true, 39.8f, null);
        var geneAppear        = new AnimatorParameterSetter <bool>(wolfCupcakeObject.GetComponent <Animator>(), "IsGeneAppear", true, 51.8f, null);
        var noColor           = new AnimatorParameterSetter <bool>(wolfCupcakeObject.GetComponent <Animator>(), "IsNoColor", true, 46.5f, null);
        var showIron          = new AnimatorParameterSetter <bool>(wolfCupcakeObject.GetComponent <Animator>(), "IsIron", true, 73.0f, null);
        var showBananaCupcake = new AnimatorParameterSetter <bool>(wolfCupcakeObject.GetComponent <Animator>(), "IsBananaCake", true, 82.5f, null);

        animations.Add(mapDisappear);

        animations.Add(cupcakeAppear);
        animations.Add(showCupcakeRecipe);
        animations.Add(wolfAppear);
        animations.Add(showWolfDna);
        animations.Add(color);
        animations.Add(showDna);
        //animations.Add(geneAppear);
        animations.Add(noColor);
        animations.Add(showIron);
        animations.Add(showBananaCupcake);
    }
    void Start()
    {
        animations = new List <IAnimationExecutor>();

        var division    = new AnimatorParameterSetter <bool>(transform.GetComponent <Animator>(), "IsDivide", true, 8.0f, null);
        var movement    = new AnimatorParameterSetter <bool>(transform.GetComponent <Animator>(), "IsMovement", true, 11.0f, null);
        var platform    = new AnimatorParameterSetter <bool>(transform.GetComponent <Animator>(), "IsPlatform", true, 20.0f, null);
        var combination = new AnimatorParameterSetter <bool>(transform.GetComponent <Animator>(), "IsCombination", true, 25.0f, null);

        animations.Add(division);
        animations.Add(movement);
        animations.Add(platform);
        animations.Add(combination);
    }
    void Start()
    {
        madeAnswers = new List <string>();
        animations  = new List <IAnimationExecutor>();
        var audioSource1 = transform.parent.Find("Audio").GetComponents <AudioSource>()[1];
        var audioSource2 = transform.parent.Find("Audio").GetComponents <AudioSource>()[2];
        var audioSource3 = transform.parent.Find("Audio").GetComponents <AudioSource>()[3];

        var playAudio1   = new AudioPlayer(audioSource1, 15.0f, null);
        var idle         = new AnimatorParameterSetter <bool>(transform.GetComponent <Animator>(), "IsIdle", true, 14.0f, null);
        var shwoDna      = new AnimatorParameterSetter <bool>(transform.GetComponent <Animator>(), "IsShowDna", true, 17.0f, null);
        var playAudio2   = new AudioPlayer(audioSource2, 26.0f, null);
        var correctDna   = new AnimatorParameterSetter <bool>(transform.GetComponent <Animator>(), "IsCorrectDna", true, 26.0f, null);
        var bacteriaFill = new AnimatorParameterSetter <bool>(transform.GetComponent <Animator>(), "IsBacteria", true, 36.0f, null);
        var playAudio3   = new AudioPlayer(audioSource3, 41.0f, null);

        animations.Add(idle);
        animations.Add(playAudio1);
        animations.Add(shwoDna);
        animations.Add(playAudio2);
        animations.Add(correctDna);
        animations.Add(bacteriaFill);
        animations.Add(playAudio3);
    }