Skip to content
Snippets Groups Projects
Commit a220e919 authored by KritzJ's avatar KritzJ
Browse files

More adjustments after testing

parent a6350a8c
No related branches found
No related tags found
No related merge requests found
......@@ -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());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment