** Make process bar icon seek

Scripts:
**Class:
using UnityEngine;
using UnityEngine.UI;

public class HeathBarIconSeek : MonoBehaviour {
    /*
    * per = length
    * 1   = -180
    * test: 0.5 = ?=> x=-90
    */
    [Header("Two Object heath")]
    public Image UiIcon;
    public Image SeekImage;
    [Header("Value Unit")]
    public float PerUnit = 1;
    public float LengUnit = -180f;
    [Header("Value Retime")]
    [Range(0,1)]
    public float SetPerCur = 0;//setvalue
    public float pointx = 0f;
    public Vector3 UIiconPoisition;
// Use this for initialization
void Start () {
        SetPerCur = SeekImage.fillAmount;
        pointx = SetPerCur * LengUnit;
        UIiconPoisition = UiIcon.rectTransform.localPosition;
}

// Update is called once per frame
void Update () {
        SeekImage.fillAmount= SetPerCur;
        pointx = SetPerCur * LengUnit;
        UIiconPoisition.x = pointx;
        UiIcon.rectTransform.localPosition = UIiconPoisition;
    }
}
Videos:




***************************
Author: Xh Studio
Page Google Store: Store Game
Game First: Pest Hunter

0 comments:

Post a Comment

Pin ThisShare on TumblrShare on Google PlusEmail This
 
Top