Example #1
0
    // Start is called before the first frame update
    void Start()
    {
        if (!(shipEntity = FindObjectOfType <ShipEntity>()))
        {
            Debug.Log(this.GetType().Name + " have not found " + typeof(ShipEntity));
        }

        if (!(baseSystem = FindObjectOfType <BaseSystem>()))
        {
            Debug.Log(this.GetType().Name + " have not found " + typeof(BaseSystem));
        }

        if (!(timerManager = FindObjectOfType <TimerManager>()))
        {
            Debug.Log(this.GetType().Name + " have not found " + typeof(TimerManager));
        }

        if (shipEntity != null)
        {
            shipTransform = shipEntity.GetComponent <Transform>();
        }

        if (baseSystem != null)
        {
            baseTransform = baseSystem.GetComponent <Transform>();
        }

        healthPointSlider.maxValue = shipEntity.MaximalHealth;
        eachNitroPointRate         = (1.0f - (coverNitroPointRate * 2.0f)) / shipEntity.MaximalNitro;
        nitroPointImage.fillAmount = (eachNitroPointRate * shipEntity.MaximalNitro) + coverNitroPointRate;
        weightPointSlider.maxValue = shipEntity.MaximalWeight;
    }