Пример #1
0
 private void GetProgram(GetProgramEvent gpei)
 {
     gpei.leftInputTimer  = leftInputTimer;
     gpei.rightInputTimer = rightInputTimer;
     gpei.upInputTimer    = upInputTimer;
     gpei.downInputTimer  = downInputTimer;
     gpei.lmbInputTimer   = lmbInputTimer;
     gpei.rmbInputTimer   = rmbInputTimer;
     gpei.mousePosTimer   = mousePosTimer;
 }
Пример #2
0
    //Run when the state starts up
    public override void Init()
    {
        //We use the event manager to grab the values, we do not call the fire event
        //becuase we dont want to store any new values just get the current ones
        GetProgramEvent gpei = new GetProgramEvent();

        gpei.FireEvent();
        leftInputTimer  = gpei.leftInputTimer;
        rightInputTimer = gpei.rightInputTimer;
        upInputTimer    = gpei.upInputTimer;
        downInputTimer  = gpei.downInputTimer;
        lmbInputTimer   = gpei.lmbInputTimer;
        rmbInputTimer   = gpei.rmbInputTimer;
        mousePosTimer   = gpei.mousePosTimer;

        //Load the map resource scene and instance it as a child of the GameProgramState node
        mapScene = ResourceLoader.Load("res://Scenes/Map.tscn") as PackedScene;
        map      = mapScene.Instance();
        AddChild(map);
        TileMap RealMap = GetNode <TileMap>("Map/ProgramMap");

        RealMap.QueueFree();
        displayMap         = GetNode <TileMap>("Map/RealMap");
        displayMap.Visible = true;
        droidScene         = ResourceLoader.Load("res://Scenes/Droid.tscn") as PackedScene;
        gunTurretScene     = ResourceLoader.Load("res://Scenes/Enemies/GunTurret.tscn") as PackedScene;
        laserTurretScene   = ResourceLoader.Load("res://Scenes/Enemies/LaserTurret.tscn") as PackedScene;
        goalScene          = ResourceLoader.Load("res://Scenes/Goal.tscn") as PackedScene;


        //Instance player and gun towers
        BuildMap();
        //Set up the camera follow for hte player
        CameraEvent cei = new CameraEvent();

        cei.target = (Node2D)droid;
        cei.FireEvent();

        //enemyScene = ResourceLoader.Load("res://Scenes/Enemy.tscn") as PackedScene;

        //Grab the time the state started after all the initializations have completely run
        timerStarted = OS.GetTicksMsec();
    }
Пример #3
0
 public override void Exit()
 {
     base.Exit();
     SendProgramEvent.UnregisterListener(StoreProgram);
     GetProgramEvent.UnregisterListener(GetProgram);
 }
Пример #4
0
 public override void Init(Node state)
 {
     base.Init(state);
     SendProgramEvent.RegisterListener(StoreProgram);
     GetProgramEvent.RegisterListener(GetProgram);
 }