package com.jan.game;

import com.jan.Collision.CollisionEvent;
import com.jan.entity.Trigger;
import com.jan.scene.Scene;

public abstract class Game {
    protected Scene currScene;

    public void create(Scene scene){
        currScene = scene;
    }

    public abstract void start();
    public abstract void update();

    public void catchEvent(CollisionEvent event){
        switch(event.getType()){
            case OBJECT: findType(event);break;
            case TERAIN: regulairCollision(event); break;
        }
    }

    private void findType(CollisionEvent event){
        if(event.getEntityA() instanceof Trigger){
            return;
        }
        objectCollision(event);
    }

    public void regulairCollision(CollisionEvent event){}
    public void objectCollision(CollisionEvent event){}
    public void trigger(CollisionEvent event){}
}
