Пример #1
0
    /** AttributePassiveToClass protected virtual void Method.
     * This method is called by the Start method. The Objective of the method is to get the Passive spell name in the championData instance.
     * Then, it get the script in the scripts library and attach it to the player.
     * If the script is not found or mispelled, the HandleException(1) is launched.
     * After that, we call the AttributeDisplayable method to give to the GUI all information in requires to display informations about the Passive.
     **/
    protected virtual void AttributePassiveToClass()
    {
        Type t = Type.GetType(championData.Passive);

        if (t == null)
        {
            HandleException(1);
            return;
        }
        passiveBase = (PassiveBase)gameObject.AddComponent(t);
        GUIPassiveDisplayer passiveDisplayer = GameObject.Find("Passive").GetComponent <GUIPassiveDisplayer>();

        passiveDisplayer.AttributeDisplayable(passiveBase);
    }
Пример #2
0
    /** AttributeDisplayable public void Method
     * @Param : IDisplayable
     * This method should be only called by the Champion class when the class is constructed.
     * We get every elements we need to displays informations to the screen (Image, number of stacks, instance of Passive etc..)
     **/
    public void AttributeDisplayable(IDisplayable displayable)
    {
        _passive = (PassiveBase)displayable;
        _passiveImgDescription.sprite = Resources.Load <Sprite>("Images/Passive/" + _passive.GetComponent <Champion>().GetType().ToString() + "/" + _passive.GetType());
        if (_passiveImgDescription.sprite == null)
        {
            _passiveImgDescription.sprite = Resources.Load <Sprite>("Images/Spells/DefaultSpell");
        }

        if (_passive.NumberOfStacks > 0)
        {
            _stackText.enabled       = true;
            _stackBackground.enabled = true;
        }
    }