public void UpdateCharacterVisuals(Vector2 visualSpaceInput)
 {
     Assert.IsTrue(CharacterSprite.enabled);
     Assert.IsNotNull(spriteSource);
     CharacterSprite.sprite = spriteSource.selectionSprite();
     if (spriteSource is IHueShiftableVisuals)
     {
         myMat.SetFloat("_Shift", (spriteSource as IHueShiftableVisuals).visualsToHueVector(visualSpaceInput).x);
     }
 }
    public void Init(int numGoals, int maxNumGoals, AbstractPlayerVisuals player)
    {
        this.numGoals = numGoals;
        this.maxNumGoals = maxNumGoals;
        this.player = player;
        playerContainer.sprite = player.selectionSprite();
        playerContainer.material = player.material;

        numGoalsText.text = numGoals.ToString();

        Callback.FireForUpdate(() => //Fire after the aspect ratio component has been initialized
        {
            transform.parent.GetComponent<LayoutElement>().preferredWidth = (transform as RectTransform).rect.width;

            LayoutElement barGraph = GetComponentInChildren<LayoutElement>();
            barGraph.flexibleHeight = 0;
            float targetHeight = ((float)numGoals / (float)maxNumGoals) * (barGraph.transform as RectTransform).rect.height;
            Callback.DoLerp((float l) => barGraph.preferredHeight = targetHeight * l * (3 + l * (-3 + l)), 1, this);
        }, this);
    }
Пример #3
0
    public void Init(int numGoals, int maxNumGoals, AbstractPlayerVisuals player)
    {
        this.numGoals            = numGoals;
        this.maxNumGoals         = maxNumGoals;
        this.player              = player;
        playerContainer.sprite   = player.selectionSprite();
        playerContainer.material = player.material;

        numGoalsText.text = numGoals.ToString();

        Callback.FireForUpdate(() => //Fire after the aspect ratio component has been initialized
        {
            transform.parent.GetComponent <LayoutElement>().preferredWidth = (transform as RectTransform).rect.width;

            LayoutElement barGraph  = GetComponentInChildren <LayoutElement>();
            barGraph.flexibleHeight = 0;
            float targetHeight      = ((float)numGoals / (float)maxNumGoals) * (barGraph.transform as RectTransform).rect.height;
            Callback.DoLerp((float l) => barGraph.preferredHeight = targetHeight * l * (3 + l * (-3 + l)), 1, this);
        }, this);
    }