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 GameObject parent;
    public CopyEntity(GameObject parent){
        this.parent = parent;
    }
    @Override
    public GameComponent copy() {
        return this;
    }


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