Skip to content

Commit

Permalink
Refactored SceneStartAction to kotlin
Browse files Browse the repository at this point in the history
  • Loading branch information
PratyushSingh07 committed Jan 28, 2023
1 parent fccbdca commit a1249a2
Showing 1 changed file with 29 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,37 +20,32 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.catrobat.catroid.content.actions;

import com.badlogic.gdx.scenes.scene2d.actions.TemporalAction;

import org.catrobat.catroid.content.Sprite;
import org.catrobat.catroid.stage.StageActivity;

public class SceneStartAction extends TemporalAction {

private String sceneName;
private Sprite sprite;

@Override
protected void update(float percent) {
if (sceneName != null) {
sprite.releaseAllPointers();
StageActivity.stageListener.startScene(sceneName);
}
}

@Override
public void reset() {
super.reset();
sceneName = null;
}

public void setScene(String sceneName) {
this.sceneName = sceneName;
}

public void setSprite(Sprite sprite) {
this.sprite = sprite;
}
}
package org.catrobat.catroid.content.actions

import com.badlogic.gdx.scenes.scene2d.actions.TemporalAction
import org.catrobat.catroid.content.Sprite
import org.catrobat.catroid.stage.StageActivity

class SceneStartAction : TemporalAction() {
private var sceneName: String? = null
private var sprite: Sprite? = null
override fun update(percent: Float) {
if (sceneName != null) {
sprite!!.releaseAllPointers()
StageActivity.stageListener.startScene(sceneName)
}
}

override fun reset() {
super.reset()
sceneName = null
}

fun setScene(sceneName: String?) {
this.sceneName = sceneName
}

fun setSprite(sprite: Sprite?) {
this.sprite = sprite
}
}

0 comments on commit a1249a2

Please sign in to comment.