Skip to content
Snippets Groups Projects
ResultProgram_modded2.xmi 6.36 KiB
Newer Older
KritzJ's avatar
KritzJ committed
<?xml version="1.0" encoding="UTF-8"?>
<cs:Program xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cs="http://www.example.org/cs.ecore" xsi:schemaLocation="http://www.example.org/cs.ecore ../metamodel/csProgram/CsProgram.ecore">
  <files filename="BarDisplayLives">
    <namespaces namespace="DSL">
      <using>UnityEngine</using>
      <using>System</using>
      <typedefs xsi:type="cs:Class" identifier="BarDisplayLives" baseType="//@externalTypes.0">
        <members identifier="maxValue">
          <type xsi:type="cs:PrimitiveType" type="float"/>
        </members>
        <members identifier="barImage">
          <type xsi:type="cs:CompoundType" referencedType="//@externalTypes.4"/>
        </members>
        <methods identifier="Update" accessability="none">
          <body>barImage.fillAmount =  DataManager.instance.GetLives()/maxValue;</body>
          <returnType xsi:type="cs:PrimitiveType"/>
        </methods>
      </typedefs>
    </namespaces>
  </files>
  <files filename="DataManager">
    <namespaces namespace="DSL">
      <using>UnityEngine</using>
      <using>System</using>
      <typedefs xsi:type="cs:Class" identifier="DataManager" baseType="//@externalTypes.0">
        <members identifier="instance" specifier="static">
          <type xsi:type="cs:CompoundType" referencedType="//@files.1/@namespaces.0/@typedefs.0"/>
        </members>
        <members identifier="lives">
          <type xsi:type="cs:PrimitiveType" type="int"/>
        </members>
        <methods identifier="Awake" accessability="private">
          <body>instance??= this;</body>
          <returnType xsi:type="cs:PrimitiveType"/>
        </methods>
        <methods identifier="GetLives">
          <body>return this.lives;</body>
          <returnType xsi:type="cs:PrimitiveType" type="int"/>
        </methods>
        <methods identifier="SetLives">
          <parameters identifier="value">
            <type xsi:type="cs:PrimitiveType" type="int"/>
          </parameters>
          <body>this.lives = value;</body>
          <returnType xsi:type="cs:PrimitiveType"/>
        </methods>
      </typedefs>
    </namespaces>
  </files>
  <files filename="HealthPack">
    <namespaces namespace="DSL">
      <using>UnityEngine</using>
      <using>System</using>
      <typedefs xsi:type="cs:Class" identifier="HealthPack" baseType="//@externalTypes.0">
        <methods identifier="Update" accessability="none">
          <returnType xsi:type="cs:PrimitiveType"/>
        </methods>
        <methods identifier="Start" accessability="none">
          <returnType xsi:type="cs:PrimitiveType"/>
        </methods>
        <methods identifier="OnTriggerEnter2D">
          <parameters identifier="collider">
            <type xsi:type="cs:CompoundType" referencedType="//@externalTypes.5"/>
          </parameters>
          <body>if (collider.gameObject.tag == &quot;Player&quot;) {</body>
          <body>DataManager.instance.SetLives(DataManager.instance.GetLives()+1);</body>
          <body>}</body>
          <returnType xsi:type="cs:PrimitiveType"/>
        </methods>
      </typedefs>
    </namespaces>
  </files>
  <files filename="Enemy">
    <namespaces namespace="DSL">
      <using>UnityEngine</using>
      <using>System</using>
      <typedefs xsi:type="cs:Class" identifier="Enemy" baseType="//@externalTypes.0">
        <methods identifier="Update" accessability="none">
          <returnType xsi:type="cs:PrimitiveType"/>
        </methods>
        <methods identifier="Start" accessability="none">
          <returnType xsi:type="cs:PrimitiveType"/>
        </methods>
        <methods identifier="OnTriggerEnter2D">
          <parameters identifier="collider">
            <type xsi:type="cs:CompoundType" referencedType="//@externalTypes.5"/>
          </parameters>
          <returnType xsi:type="cs:PrimitiveType"/>
        </methods>
      </typedefs>
    </namespaces>
  </files>
  <files filename="Character">
    <namespaces namespace="DSL">
      <using>UnityEngine</using>
      <using>System</using>
      <typedefs xsi:type="cs:Class" identifier="Character" baseType="//@externalTypes.0">
        <members identifier="speed">
          <type xsi:type="cs:PrimitiveType" type="float"/>
        </members>
        <members identifier="horizontal" accessability="private">
          <type xsi:type="cs:PrimitiveType" type="float"/>
        </members>
        <members identifier="rigidbody">
          <type xsi:type="cs:CompoundType" referencedType="//@externalTypes.2"/>
        </members>
        <members identifier="vertical" accessability="private">
          <type xsi:type="cs:PrimitiveType" type="float"/>
        </members>
        <methods identifier="Update" accessability="none">
          <body>horizontal = Input.GetAxisRaw(&quot;Horizontal&quot;);</body>
          <body>vertical = Input.GetAxisRaw(&quot;Vertical&quot;);</body>
          <body>rigidbody.velocity = new Vector2(horizontal * speed, vertical * speed);</body>
          <body>if (Input.GetKeyDown(KeyCode.P)) {</body>
          <body>rigidbody.AddForce(new Vector2(1,0)*10.0f, ForceMode2D.Impulse);</body>
          <body>}</body>
          <returnType xsi:type="cs:PrimitiveType"/>
        </methods>
        <methods identifier="Start" accessability="none">
          <returnType xsi:type="cs:PrimitiveType"/>
        </methods>
        <methods identifier="OnTriggerEnter2D">
          <parameters identifier="collider">
            <type xsi:type="cs:CompoundType" referencedType="//@externalTypes.5"/>
          </parameters>
          <body>if (collider.gameObject.tag == &quot;Enemy&quot;) {</body>
          <body>DataManager.instance.SetLives(DataManager.instance.GetLives()-1);</body>
          <body>}</body>
          <returnType xsi:type="cs:PrimitiveType"/>
        </methods>
      </typedefs>
    </namespaces>
  </files>
  <externalTypes identifier="MonoBehaviour" importedFrom="UnityEngine"/>
  <externalTypes identifier="Vector2" importedFrom="UnityEngine" type="struct"/>
  <externalTypes identifier="Rigidbody2D" importedFrom="UnityEngine"/>
  <externalTypes identifier="Text" importedFrom="UnityEngine.UI"/>
  <externalTypes identifier="Image" importedFrom="UnityEngine.UI"/>
  <externalTypes identifier="Collider2D" importedFrom="UnityEngine"/>
  <externalTypes identifier="Collision2D" importedFrom="UnityEngine"/>
  <externalTypes identifier="GameObject" importedFrom="UnityEngine"/>
</cs:Program>