Hero.safeFadeTo C# (CSharp) Method

safeFadeTo() public static method

public static safeFadeTo ( GameObject toFade, Hashtable fadeOptions ) : void
toFade GameObject
fadeOptions Hashtable
return void
    public static void safeFadeTo(GameObject toFade, Hashtable fadeOptions) {
        //TODO find most robust method
        //GameObject body = gameObject.GetComponentsInChildren<SkinnedMeshRenderer>(). .transform.FindChild("body_perso");
        //GameObject body = gameObject.transform.FindChild("body_perso").gameObject;
        GameObject body = toFade.transform.FindChild("body_perso").transform.FindChild("body_perso").gameObject;
        if(null != body)
        {
            iTween.FadeTo(body, fadeOptions);
        }
        GameObject dna = toFade.transform.FindChild("dna_perso").transform.FindChild("body_perso").gameObject;
        if(null != dna)
        {
            iTween.FadeTo(dna, fadeOptions);
        }
    }

Same methods

Hero::safeFadeTo ( Hashtable hash ) : void

Usage Example

Beispiel #1
0
    public void initialize(Hero playableCell, Vector3 checkpointPosition)
    {
        //TODO find systematic way of doing this

        Destroy(GetComponent <Hero>());
        Destroy(GetComponent <CellControl>());
        Destroy(GetComponent <PhysicalMedium>());
        Destroy(GetComponent <PhenoSpeed>());
        Destroy(GetComponent <PhenoLight>());
        Destroy(GetComponent <PhenoToxic>());
        Destroy(GetComponent <PhenoFickContact>());
        Destroy(GetComponent <BlackLight>());
        Destroy(GetComponent <Rigidbody>());

        SphereCollider[] colliders = GetComponentsInChildren <SphereCollider>();
        for (int i = 0; i < colliders.Length; i++)
        {
            if (colliders[i].gameObject.name == "PhenoLight")
            {
                colliders[i].enabled = false;
            }
        }

        resetCollisionState();

        SwimAnimator newCellSwimAnimator = (SwimAnimator)GetComponent <SwimAnimator>();

        newCellSwimAnimator.setSpeed(_waitAnimationSpeed);

        transform.position   = playableCell.transform.position;
        transform.localScale = playableCell.transform.localScale;

        //TODO set slow animation
        //TODO change appearance to make it different from playable bacterium: maybe remove eyes?
        //TODO put animation when bacterium becomes playable, then divide cell
        Hero.safeFadeTo(gameObject, _optionsDuplicatedAlpha);
    }