示例#1
0
    public void setInRange(bool inRange, GameObject go)
    {
        if (!iScript)
        {
            iScript = ActionIcon.GetComponent <actionIcon>();
        }
        if (iScript)
        {
            iScript.setVisible(inRange);
        }
        range = inRange;

        if (characterObject != null)
        {
            CharacterController2D cont = characterObject.GetComponent <CharacterController2D>() as CharacterController2D;
            if (cont.getActionObjectInRange() == gameObject)
            {
                cont.setActionObjectInRange(null);
            }
        }

        characterObject = go;

        if (characterObject != null)
        {
            var cont = characterObject.GetComponent <CharacterController2D>();
            if (cont)
            {
                cont.setActionObjectInRange(gameObject);
            }
        }
    }