<?xml version="1.0" encoding="UTF-8"?>
<class name="Igel" extends="Actor" extends-java="Actor" enable="true" strideversion="1">
    <javadoc xml:space="preserve">Der Igel haust im Walde.</javadoc>
    <imports>
        <import target="java.util.*" enable="true"/>
        <import target="greenfoot.*" enable="true"/>
    </imports>
    <implements/>
    <fields>
        <variable access="private" type="ArrayList&lt;Waldfrucht&gt;" type-java="ArrayList&lt;Waldfrucht&gt;" name="meineWaldfruechte" enable="true"/>
        <variable access="private" type="int" type-java="int" name="plaetzeImInventar" value="2" value-java="2" enable="true"/>
    </fields>
    <constructors>
        <constructor access="public" enable="true">
            <javadoc xml:space="preserve"/>
            <params/>
            <throws/>
            <body>
                <call expression="this.getImage().scale(this.getImage().getWidth()/4,this.getImage().getHeight()/4)" expression-java="this.getImage().scale(this.getImage().getWidth() / 4, this.getImage().getHeight() / 4)" enable="true"/>
                <assign dest="this.meineWaldfruechte" dest-java="this.meineWaldfruechte" src="new ArrayList&lt;Waldfrucht&gt;()" src-java=" new ArrayList &lt; Waldfrucht &gt; ()" enable="true"/>
            </body>
        </constructor>
    </constructors>
    <methods>
        <method access="public" type="void" type-java="void" name="act" enable="true">
            <javadoc xml:space="preserve">Act - tut, was auch immer Affe tun will. Diese Methode wird aufgerufen, sobald der 'Act' oder 'Run' Button in der Umgebung angeklickt werden.</javadoc>
            <params/>
            <throws/>
            <body>
                <call expression="this.tastensteuerungPruefen()" expression-java="this.tastensteuerungPruefen()" enable="true"/>
                <if condition="this.isTouching(Waldfrucht.class)" condition-java="this.isTouching(Waldfrucht.class)" enable="true">
                    <ifStatements>
                        <variable type="Waldfrucht" type-java="Waldfrucht" name="w" value="(Waldfrucht)this.getOneIntersectingObject(Waldfrucht.class)" value-java="(Waldfrucht)this.getOneIntersectingObject(Waldfrucht.class)" enable="true"/>
                        <if condition="this.meineWaldfruechte.size()&lt;this.plaetzeImInventar" condition-java="this.meineWaldfruechte.size() &lt; this.plaetzeImInventar" enable="true">
                            <ifStatements>
                                <call expression="this.meineWaldfruechte.add(w)" expression-java="this.meineWaldfruechte.add(w)" enable="true"/>
                                <call expression="this.getWorld().removeObject(w)" expression-java="this.getWorld().removeObject(w)" enable="true"/>
                            </ifStatements>
                            <else>
                                <call expression="this.getWorld().showText(&quot;Kein Platz mehr!&quot;,400,200)" expression-java="this.getWorld().showText(&quot;Kein Platz mehr!&quot;, 400, 200)" enable="true"/>
                            </else>
                        </if>
                    </ifStatements>
                </if>
            </body>
        </method>
        <method access="public" type="boolean" type-java="boolean" name="hatTomate" enable="true">
            <javadoc xml:space="preserve"/>
            <params/>
            <throws/>
            <body>
                <variable type="boolean" type-java="boolean" name="rueckgabe" value="false" value-java="false" enable="true"/>
                <foreach type="Waldfrucht" type-java="Waldfrucht" var="eineWaldfrucht" collection="this.meineWaldfruechte" collection-java="this.meineWaldfruechte" enable="true">
                    <if condition="eineWaldfrucht.getName().equals(&quot;Tomate&quot;)" condition-java="eineWaldfrucht.getName().equals(&quot;Tomate&quot;)" enable="true">
                        <ifStatements>
                            <assign dest="rueckgabe" dest-java="rueckgabe" src="true" src-java="true" enable="true"/>
                        </ifStatements>
                    </if>
                </foreach>
                <return value="rueckgabe" value-java="rueckgabe" enable="true"/>
            </body>
        </method>
        <method access="public" type="void" type-java="void" name="mitDenVielenWaldfruechtenProtzen" enable="true">
            <javadoc xml:space="preserve"/>
            <params/>
            <throws/>
            <body>
                <variable type="int" type-java="int" name="gesamtgewicht" value="0" value-java="0" enable="true"/>
                <foreach type="Waldfrucht" type-java="Waldfrucht" var="eineWaldfrucht" collection="this.meineWaldfruechte" collection-java="this.meineWaldfruechte" enable="true">
                    <call expression="System.out.println(&quot;Ich habe das &quot;+eineWaldfrucht.getName())" expression-java="System.out.println(&quot;Ich habe das &quot; + eineWaldfrucht.getName())" enable="true"/>
                    <assign dest="gesamtgewicht" dest-java="gesamtgewicht" src="gesamtgewicht+eineWaldfrucht.getGewicht()" src-java="gesamtgewicht + eineWaldfrucht.getGewicht()" enable="true"/>
                </foreach>
                <call expression="System.out.println(&quot;+++ Gesamtlast: &quot;+gesamtgewicht)" expression-java="System.out.println(&quot;+++ Gesamtlast: &quot; + gesamtgewicht)" enable="true"/>
            </body>
        </method>
        <method access="public" type="void" type-java="void" name="tastensteuerungPruefen" enable="true">
            <javadoc xml:space="preserve"/>
            <params/>
            <throws/>
            <body>
                <if condition="Greenfoot.isKeyDown(&quot;left&quot;)" condition-java="Greenfoot.isKeyDown(&quot;left&quot;)" enable="true">
                    <ifStatements>
                        <call expression="this.setLocation(this.getX()-3,this.getY())" expression-java="this.setLocation(this.getX() - 3, this.getY())" enable="true"/>
                    </ifStatements>
                </if>
                <if condition="Greenfoot.isKeyDown(&quot;right&quot;)" condition-java="Greenfoot.isKeyDown(&quot;right&quot;)" enable="true">
                    <ifStatements>
                        <call expression="this.setLocation(this.getX()+3,this.getY())" expression-java="this.setLocation(this.getX() + 3, this.getY())" enable="true"/>
                    </ifStatements>
                </if>
                <if condition="Greenfoot.isKeyDown(&quot;up&quot;)" condition-java="Greenfoot.isKeyDown(&quot;up&quot;)" enable="true">
                    <ifStatements>
                        <call expression="this.setLocation(this.getX(),this.getY()-3)" expression-java="this.setLocation(this.getX(), this.getY() - 3)" enable="true"/>
                    </ifStatements>
                </if>
                <if condition="Greenfoot.isKeyDown(&quot;down&quot;)" condition-java="Greenfoot.isKeyDown(&quot;down&quot;)" enable="true">
                    <ifStatements>
                        <call expression="this.setLocation(this.getX(),this.getY()+3)" expression-java="this.setLocation(this.getX(), this.getY() + 3)" enable="true"/>
                    </ifStatements>
                </if>
            </body>
        </method>
    </methods>
</class>
