Example #1
0
    /**
     * Sets the texture of the component with the given index.
     *
     * @param tex The new texture of the object.
     * @param i The index of the game object to set the texture of. Must be a valid index.
     * @param all Whether to set the index relative to all objects, or only the main objects.
     */
    private void setTex(Texture2D tex, int i, bool all)
    {
        SetTextures st = getSetTextures(all ? _TargetObjects[i] : _MainTargetObjects[i]);

        if (st != null)
        {
            st.setTexture(tex);
        }
    }
Example #2
0
    /**
     * @return The {@code SetTextures} script of the game object, or {@code null} if it doesn't have any.
     */
    private SetTextures getSetTextures(GameObject obj)
    {
        SetTextures st = obj.GetComponent <SetTextures>();

        if (st == null)
        {
            Debug.LogError("Expected the game object with label '" + objectTag
                           + "' to have the script 'SetTextures', but '" + obj
                           + "' didn't have this.");
        }
        return(st);
    }
Example #3
0
    /**
     * Checks if the target is visible.
     */
    public bool isTargetVisible()
    {
        GameObject obj = getTargetObject();

        if (obj == null)
        {
            return(false);
        }
        SetTextures st = getSetTextures(obj);

        if (st == null)
        {
            return(false);
        }
        return(st.isVisible());
    }