コード例 #1
0
ファイル: WorldObject.cs プロジェクト: FuchsFa/Robot-Puzzle
    /// <summary>
    /// Versucht ein Objekt vor sich zu bemalen.
    /// </summary>
    /// <returns></returns>
    public DynValue Paint(string colorName)
    {
        //Debug.Log(name + " versucht, etwas zu bemalen.");

        Color paintColor;

        ColorUtility.TryParseHtmlString(colorName, out paintColor);
        if (paintColor == null)
        {
            return(DynValue.NewYieldReq(new DynValue[] { coroutine }));
        }

        WorldObject target = GetComponent <RayCaster>().CheckForWorldObject(myInteractiveObject.direction);

        if (target != null && target.objectColor != paintColor)
        {
            target.ChangeColor(paintColor);
        }
        else
        {
            Debug.Log("Objekt '" + target.name + "' kann nicht bemalt werden.");
        }

        return(DynValue.NewYieldReq(new DynValue[] { coroutine }));
    }