diff --git a/projectMDE/transforms/UGameTransform_modded.qvto b/projectMDE/transforms/UGameTransform_modded.qvto index 064bccbdcb67a39d5bb6205b30e7d4a7e5f67189..beea504a10e69a9abaf59b0c21623f07920c8c1b 100644 --- a/projectMDE/transforms/UGameTransform_modded.qvto +++ b/projectMDE/transforms/UGameTransform_modded.qvto @@ -263,15 +263,20 @@ mapping Unity::GameObject::GameObj2Class() : Prog::Class { } helper Unity::Actionkey::SetActionKeyBody(inout updatemethod:Prog::MethodDef,inout creationCounter:Integer){ + log(''); + log('Starting Key'); if (self.pressType = KeyType::Instant) then { + log('instant key'); updatemethod.body +='if (Input.GetKeyDown(KeyCode.'+self.key+')) {'; } else if (self.pressType = KeyType::Repeated) then { + log('repeated key'); updatemethod.body +='if (Input.GetKey(KeyCode.'+self.key+')) {' } endif endif; self.execute->forEach(action){ + log('actionkeyadded'); updatemethod.body += action.Action2Body(creationCounter); }; updatemethod.body+='}' @@ -318,15 +323,15 @@ helper Unity::GameAction::Action2Body(inout creationCounter: Integer) : String { }; if(self.oclIsTypeOf(Unity::ApplyForce)){ if (self.oclAsType(Unity::ApplyForce).isInstant){ - return 'rigidbody.AddForce(new Vector2('+self.oclAsType(Unity::ApplyForce).direction->at(2).toString()+','+self.oclAsType(Unity::ApplyForce).direction->at(2).toString()+')*'+self.oclAsType(Unity::ApplyForce).intensity.toString()+'f, ForceMode2D.Impulse);' + return 'rigidbody.AddForce(new Vector2('+self.oclAsType(Unity::ApplyForce).direction->at(1).toString()+','+self.oclAsType(Unity::ApplyForce).direction->at(2).toString()+')*'+self.oclAsType(Unity::ApplyForce).intensity.toString()+'f, ForceMode2D.Impulse);' }else{ - return 'rigidbody.AddForce(new Vector2('+self.oclAsType(Unity::ApplyForce).direction->at(2).toString()+','+self.oclAsType(Unity::ApplyForce).direction->at(2).toString()+')*'+self.oclAsType(Unity::ApplyForce).intensity.toString()+'f);' + return 'rigidbody.AddForce(new Vector2('+self.oclAsType(Unity::ApplyForce).direction->at(1).toString()+','+self.oclAsType(Unity::ApplyForce).direction->at(2).toString()+')*'+self.oclAsType(Unity::ApplyForce).intensity.toString()+'f);' }; }; if(self.oclIsTypeOf(Unity::ObjectCreation)){ var currentCounter: Integer = creationCounter; creationCounter := creationCounter + 1; - return 'Instantiate(createdObject'+currentCounter.toString()+', transform.position + new Vector3('+self.oclAsType(Unity::ObjectCreation).position->at(2).toString()+','+self.oclAsType(Unity::ObjectCreation).position->at(2).toString()+',0), transform.rotation);' + return 'Instantiate(createdObject'+currentCounter.toString()+', transform.position + new Vector3('+self.oclAsType(Unity::ObjectCreation).position->at(1).toString()+','+self.oclAsType(Unity::ObjectCreation).position->at(2).toString()+',0),createdObject'+currentCounter.toString()+'.transform.rotation);' }; log('failed to convert action ' + self.toString());