예제 #1
0
    public void Initialise(IComponentController shield)
    {
        Shield               = (ShieldController)shield;
        ShieldNameLabel      = transform.Find("ShieldName").GetComponent <Text>();
        ShieldNameLabel.text = Shield.Name;

        TargetButton = transform.Find("TargetButton").GetComponent <Button>();
        TargetButton.onClick.AddListener(StartTargeting);

        ArcButton = transform.Find("ArcButton").GetComponent <Button>();
        ArcButton.onClick.AddListener(ToggleArc);

        DirectionSlider = transform.Find("DirectionSlider").GetComponent <Slider>();
        DirectionSlider.onValueChanged.AddListener(SetDirection);
        DirectionSlider.value        = Shield.GetRotationProportion();
        DirectionSlider.interactable = (Shield.GetTarget() == null);

        RechargeToggle      = transform.Find("RechargeToggle").GetComponent <Toggle>();
        RechargeToggle.isOn = Shield.Recharging;
        RechargeToggle.onValueChanged.AddListener(SetRecharging);


        // store text color so we can set back
        labelColor  = ShieldNameLabel.color;
        buttonColor = TargetButton.GetComponentInChildren <Text>().color;
    }
예제 #2
0
    public void StopTargeting(ShipController ship)
    {
        // set color back
        ShieldNameLabel.color = labelColor;
        TargetButton.GetComponentInChildren <Text>().color = buttonColor;

        DirectionSlider.interactable = (Shield.GetTarget() == null);
    }