本文整理汇总了C#中Maze.Generate方法的典型用法代码示例。如果您正苦于以下问题:C# Maze.Generate方法的具体用法?C# Maze.Generate怎么用?C# Maze.Generate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Maze
的用法示例。
在下文中一共展示了Maze.Generate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BeginGame
private IEnumerator BeginGame()
{
mazeInstance = Instantiate(mazePrefab) as Maze;
yield return StartCoroutine (mazeInstance.Generate());
playerInstance = Instantiate(playerPrefab) as Player;
playerInstance.SetLocation(mazeInstance.GetCell(mazeInstance.RandomCoordinates));
StartCoroutine(mazeInstance.Generate());
}
示例2: BeginGame
private void BeginGame()
{
mazeInstance = Instantiate(mazePrefab) as Maze;
//StartCoroutine(mazeInstance.Generate());
mazeInstance.Generate();
timeLimit = mazeInstance.difficulty *1.5f;
timerText.color = new Color(0,1,213.0f/255.0f);
}
示例3: BeginGame
private IEnumerator BeginGame () {
Camera.main.clearFlags = CameraClearFlags.Skybox;
Camera.main.rect = new Rect(0f, 0f, 1f, 1f);
mazeInstance = Instantiate(mazePrefab) as Maze;
yield return StartCoroutine(mazeInstance.Generate());
playerInstance = Instantiate(playerPrefab) as Player;
playerInstance.SetLocation(mazeInstance.GetCell(mazeInstance.RandomCoordinates));
Camera.main.clearFlags = CameraClearFlags.Depth;
Camera.main.rect = new Rect(0f, 0f, 0.5f, 0.5f);
}
示例4: BeginGame
private void BeginGame () {
mazeInstance = Instantiate(mazePrefab) as Maze;
mazeInstance.Generate();
if (!mazeInstance.IsGeneratedMazeAccepted ()) {
RestartGame ();
return;
}
new MazeOptimization (mazeInstance);
new ObjectsPlacement (mazeInstance);
}
示例5: BeginGame
private IEnumerator BeginGame()
{
Camera.main.clearFlags = CameraClearFlags.Skybox;
Camera.main.rect = new Rect(0f, 0f, 1f, 1f);
HUDInfo._Hunger = 200;
mazeInstance = Instantiate(mazePrefab) as Maze;
yield return StartCoroutine(mazeInstance.Generate());
playerInstance = Instantiate(playerPrefab) as Player;
playerInstance.SetLocation(mazeInstance.GetCell(mazeInstance.RandomCoordinates));
Player.gameOver = false;
foodInstance = Instantiate(foodPrefab) as Food;
SpawnNewFood();
Camera.main.clearFlags = CameraClearFlags.Depth;
Camera.main.rect = new Rect(0f, 0f, 0.5f, 0.5f);
}
示例6: BeginGame
private void BeginGame() {
mazeInstance = Instantiate(mazePrefab) as Maze;
mazeInstance.Generate();
playerInstance = Instantiate(playerPrefab) as Player;
IntVector2 playerStartCoords = mazeInstance.PlacePlayerInMaze(playerInstance);
exitCellCoords = mazeInstance.PlaceExitCell(playerStartCoords);
gameAiInstance = Instantiate(gameAiPrefab) as GameAI;
gameAiInstance.player = playerInstance;
gameAiInstance.maze = mazeInstance;
playerInstance.EnablePlayerCamera();
}
示例7: BeginGame
private void BeginGame()
{
//Camera.main.clearFlags = CameraClearFlags.Skybox;
Camera.main.rect = new Rect(0f, 0f, 1f, 1f);
mazeInstance = Instantiate(mazePrefab) as Maze;
//StartCoroutine(mazeInstance.Generate());
mazeInstance.Generate();
playerInstance = Instantiate(playerPrefab) as GameObject;
playerInstance.GetComponent<Player>().SetLocation(mazeInstance.GetCell(mazeInstance.RandomCoordinates));
Vector3 scaleVector = new Vector3(0.1f, 0.1f, 0.1f);
playerInstance.transform.localScale = scaleVector;
//playerInstance.GetComponent<Renderer>().transform.localScale = scaleVector;
//Camera.main.clearFlags = CameraClearFlags.Color;
Camera.main.SetReplacementShader(Shader.Find("Unlit/Color"), "");
Camera.main.rect = new Rect(0f, 0f, 0.2f, 0.2f);
}
示例8: GenerateMaze
public static void GenerateMaze(double W, double H, int GridX, int GridY)
{
List<Tuple<Vector, Point2D>> LookupTable = new List<Tuple<Vector, Point2D>>();
Func<Vector, Point2D> TableGet = (A) => {
for (int i = 0; i < LookupTable.Count; i++)
if (LookupTable[i].Item1 == A)
return LookupTable[i].Item2;
return null;
};
Maze M = new Maze(GridX, GridY);
Line[] Lines = M.Generate(W, H);
EditSketch(GetCurrentSketch(), (F) => {
for (int i = 0; i < Lines.Length; i++)
F.DrawLine(Lines[i]);
/*Line2D L = F.DrawLine(new Vector(20, 20), new Vector(100, 100));
F.DrawLine(L.EndPoint, new Vector(30, 20));*/
});
GetCurrentPartDocument().Part.Update();
}
示例9: BeginGame
private IEnumerator BeginGame()
{
Camera.main.clearFlags = CameraClearFlags.Skybox;
Camera.main.rect = new Rect(0f, 0f, 1f, 1f);
mazeInstance = Instantiate(mazePrefab) as Maze;
yield return StartCoroutine(mazeInstance.Generate());
playerInstance = Instantiate(playerPrefab) as Player;
boxInstance = Instantiate (boxPrefab) as Box;
boxInstance2 = Instantiate (boxPrefab) as Box;
boxInstance3 = Instantiate (boxPrefab) as Box;
samuraiInstance = Instantiate (samurai) as Player;
playerInstance.SetLocation(mazeInstance.GetCell(mazeInstance.RandomCoordinates));
boxInstance.SetLocation (mazeInstance.GetCell (mazeInstance.RandomCoordinates));
boxInstance2.SetLocation (mazeInstance.GetCell (mazeInstance.RandomCoordinates));
boxInstance3.SetLocation (mazeInstance.GetCell (mazeInstance.RandomCoordinates));
samuraiInstance.SetLocation (mazeInstance.GetCell (mazeInstance.RandomCoordinates));
this.transform.position = samuraiInstance.transform.position;
audio.Play ();
Debug.Log (this.transform.GetChild (0).transform.name);
this.transform.GetChild (0).audio.Play ();
start = true;
Camera.main.clearFlags = CameraClearFlags.Depth;
Camera.main.rect = new Rect(0f, 0f, 0.5f, 0.5f);
}
示例10: BeginGame
private void BeginGame()
{
mazeInstance = Instantiate(mazePrefab) as Maze;
if (menuState == 3)
{
mazeInstance.size = size;
mazeInstance.RLR = RLR;
mazeInstance.LRL = LRL;
mazeInstance.UDU = UDU;
mazeInstance.DUD = DUD;
mazeInstance.Generate();
CreatePlayer();
ballInstance.GetComponent<Movement>().controls = controls;
}
else
{
mazeInstance.menuState = menuState;
mazeInstance.size = new IntVector2(23, 19);
StartCoroutine(mazeInstance.GenerateStepByStep());
}
}
示例11: BeginGame
private void BeginGame()
{
mazeInstance = Instantiate(mazePrefab) as Maze;
StartCoroutine(mazeInstance.Generate());
player = GameObject.FindGameObjectWithTag ("Player");
}
示例12: StartGame
private IEnumerator StartGame()
{
Debug.Log ("Start Game");
mazeInstance = Instantiate(mazePrefab) as Maze;
yield return StartCoroutine(mazeInstance.Generate());
}
示例13: BeginGame
private void BeginGame()
{
mazeInstance = Instantiate(mazePrefab) as Maze;
mazeInstance.Generate();
}
示例14: Main
//.........这里部分代码省略.........
true,
true,
Format.D24X8,
PresentFlags.None,
0,
PresentInterval.Immediate);
input = new Input(form);
device = new Device(direct3D, 0, DeviceType.Hardware, form.Handle, CreateFlags.HardwareVertexProcessing, Parametres);
vertexElems3D = new[] {
new VertexElement(0, // POSITION
0,
DeclarationType.Float4, DeclarationMethod.Default, DeclarationUsage.Position, 0),
new VertexElement(0, // TEXCOORD0
Convert.ToInt16(Utilities.SizeOf<Vector4>()),
DeclarationType.Float2, DeclarationMethod.Default,DeclarationUsage.TextureCoordinate,0),
new VertexElement(0, // COLOR0
Convert.ToInt16(Utilities.SizeOf<Vector4>()+Utilities.SizeOf<Vector2>()),
DeclarationType.Float4, DeclarationMethod.Default, DeclarationUsage.Color, 0),
new VertexElement(0, // NORMAL0
Convert.ToInt16(Utilities.SizeOf<Vector4>()+Utilities.SizeOf<Vector2>()+Utilities.SizeOf<Vector4>()),
DeclarationType.Float4, DeclarationMethod.Default, DeclarationUsage.Normal, 0),
new VertexElement(0, // TANGENT
Convert.ToInt16(Utilities.SizeOf<Vector4>()+Utilities.SizeOf<Vector2>()+Utilities.SizeOf<Vector4>()+Utilities.SizeOf<Vector4>()),
DeclarationType.Float4, DeclarationMethod.Default, DeclarationUsage.Tangent, 0),
VertexElement.VertexDeclarationEnd,
new VertexElement(0, // booléen de bump mapping
Convert.ToInt16(Utilities.SizeOf<Vector4>()+Utilities.SizeOf<Vector2>()+Utilities.SizeOf<Vector4>()+Utilities.SizeOf<Vector4>()+Utilities.SizeOf<Vector4>()),
DeclarationType.Float1, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0),
VertexElement.VertexDeclarationEnd,
};
vertexElems2D = new[] {
new VertexElement(0,0,DeclarationType.Float4,DeclarationMethod.Default,DeclarationUsage.PositionTransformed,0),
new VertexElement(0,16,DeclarationType.Float2,DeclarationMethod.Default,DeclarationUsage.TextureCoordinate,0),
VertexElement.VertexDeclarationEnd
};
VertexDeclaration3D = new VertexDeclaration(Program.device, Program.vertexElems3D);
VertexDeclaration2D = new VertexDeclaration(Program.device, Program.vertexElems2D);
VertexBufferZero = new VertexBuffer(IntPtr.Zero);
device.VertexDeclaration = VertexDeclaration3D;
Program.device.SetRenderState(RenderState.AlphaBlendEnable, true); // graphics.GraphicsDevice.RenderState.AlphaBlendEnable = true;
Program.device.SetRenderState(RenderState.DestinationBlend, Blend.InverseSourceAlpha); // graphics.GraphicsDevice.RenderState.DestinationBlend = Blend.One;
Program.device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha); // graphics.GraphicsDevice.RenderState.SourceBlend = Blend.One;
Program.device.SetRenderState(RenderState.AlphaFunc, BlendOperation.Maximum); // graphics.GraphicsDevice.RenderState.BlendFunction = BlendFunction.Add;
Program.device.SetRenderState(RenderState.AlphaTestEnable, true);
Program.device.SetRenderState(RenderState.MinTessellationLevel, 8);
#endregion
Liste_textures = new List<structTexture>();
Liste_binaires = new List<structBinary>();
Liste_OBJ = new List<structOBJ>();
Liste_Lights = new Light[2];
Liste_Lights[0].Type = LightType.Point;
Liste_Lights[0].Position = new Vector3(0, 0, 0);
Liste_Lights[0].Ambient = new Color4(0.5f, 0.5f, 0.5f, 1);
Liste_Lights[0].Range = 30f * 70;
Liste_Lights[1].Type = LightType.Point;
Liste_Lights[1].Position = new Vector3(-100, -100, -100);
Liste_Lights[1].Ambient = new Color4(0.5f,0,0,1);
Liste_Lights[1].Range = 5f * 70;
Liste_textures.Add(new structTexture("null.bmp", Texture.FromFile(device, "null.bmp")));
//Ingame.Slender.doit_etre_recharge = true;
// Creation du fichier effect de référence
Macro macro = new Macro("nblights", 2.ToString());
BaseEffect = Effect.FromFile(Program.device, "Underground.fx", new Macro[] { macro }, null, "", ShaderFlags.OptimizationLevel3);
BaseEffect.Technique = BaseEffect.GetTechnique(0);
BaseEffect.SetValue("AmbientLightColor", new Vector4(0f, 0f, 0f, 0f));
Matrix proj = Matrix.PerspectiveFovLH((float)Math.PI / 4.0f, Program.form.ClientSize.Width / (float)Program.form.ClientSize.Height, 0.1f, 7000.0f);
BaseEffect.SetValue("Projection", proj);
BaseEffect.SetValue("LightDiffuseColor[0]", Liste_Lights[0].Ambient);
BaseEffect.SetValue("LightDiffuseColor[1]", Liste_Lights[1].Ambient);
BaseEffect.SetValue("LightDistanceSquared[1]", Liste_Lights[1].Range);
Thread ThSound = new Thread(Sound.main);
Thread ThEvents = new Thread(Ingame.fevents);
ThSound.Start();
ThEvents.Start();
Menu.Initialize_Menu();
ObjLoader.Initialize();
newmaze = new Maze(10, 10);
newmaze.Initecelles();
newmaze.Generate(newmaze.maze[0, 0]);
newmaze.impefectGenerate();
newmaze.Setaffichage();
Ingame.ingame();
Menu.Dispose();
ThSound.Abort();
ThEvents.Abort();
VertexBufferZero.Dispose();
VertexDeclaration3D.Dispose();
VertexDeclaration2D.Dispose();
device.Dispose();
direct3D.Dispose();
}
示例15: BeginGame
private IEnumerator BeginGame () {
audio.PlayOneShot(_Introduction, 1f);
mazeInstance = Instantiate(mazePrefab) as Maze;
yield return StartCoroutine(mazeInstance.Generate());
SpawnPlayer();
SpawnMinotaur();
exitInstance = Instantiate(exitPrefab) as ExitPoint;
exitInstance.SetLocation(mazeInstance.GetCell(mazeInstance.RandomCoordinates));
Lives = 1;
alive = true;
winState = false;
gameOver = false;
restart = false;
}