Newer
Older
AlgebraicDataflowArchitectureModel / GameEngine / src / main / java / gameEngine / entites / gameComponents / CopyEntity.java
package gameEngine.entites.gameComponents;

import gameEngine.entites.Entity;
import gameEngine.entites.GameObject;
import gameEngine.input.Input;
import gameEngine.views.Window;

import static org.lwjgl.glfw.GLFW.GLFW_KEY_G;

public class CopyEntity extends GameComponent{

    Window window = Window.get();
    private Entity entity;
    public CopyEntity(Entity entity){
        this.entity = entity;
    }
    @Override
    public GameComponent copy() {
        return this;
    }


    public void update() {
        if(Input.GetKeyDown(GLFW_KEY_G)){
            window.getScene().Instantiate((GameObject) entity);
            System.out.println(entity.getName() + " copied.");
        }
    }
}