public override void PlayerJoinedEvent(PlayerProfile profile) { List <MineralRock> AllRocks = new List <MineralRock>(); foreach (MineralRock r in Enumerate(typeof(MineralRock))) { if (r.IsStartingZone.get() == 1 && r.miningPlatform == null) { AllRocks.Add(r); } } if (AllRocks.Count == 0) { return; } PlayerShip p = (PlayerShip)ParentLevel.AddObject(new PlayerShip(-1, profile)); ChooseStartState.AddPlayer(); MineralRock SelectedRock = AllRocks[Rand.r.Next(AllRocks.Count)]; p.Position.set(SelectedRock.Position.get()); SelectedRock.Interact(p); }
public void rebuild() { CellJobQue.Clear(); for (int x = 0; x < CellsX.get(); x++) { for (int y = 0; y < CellsY.get(); y++) { CellGrid[x, y] = NeutralCell; } } foreach (GameObject o in ParentScene.Children) { if (o.GetType().Equals(typeof(MineralRock))) { MineralRock s = (MineralRock)o; //if (s.miningPlatform == null) // commitWorldBlocker(s); } else if (o.GetType().IsSubclassOf(typeof(SolidStaticWorldObject))) { SolidStaticWorldObject s = (SolidStaticWorldObject)o; commitWorldBlocker(s); } else if (o.GetType().Equals(typeof(WallNode))) { WallNode s = (WallNode)o; commitWorldBlocker(s); } } foreach (MiningPlatform r in Parent2DScene.Enumerate(typeof(MiningPlatform))) { if (!r.Dead) { addMineralRock(r); } } }
public void setRock(MineralRock rock) { this.MyRock = rock; }