本文整理汇总了C#中direction类的典型用法代码示例。如果您正苦于以下问题:C# direction类的具体用法?C# direction怎么用?C# direction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
direction类属于命名空间,在下文中一共展示了direction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: constructHorizontalLayer
public bool constructHorizontalLayer(List<Data.Rectangle> rectangle, int w,int h)
{
this.directionOfLayer = direction.Horizontal;
int w1 = 0;
this.start = h;
this.end = -1;
while (w1 < w )
{
if (rectangle.Count == 0)
{
Console.WriteLine("Zabraklo prostokatow by skonczyc warstwe");
return false; //moze cos lepiej
}
Data.Rectangle rect = rectangle[0];
rectangle.Remove(rect);
this.listUsedRectangles.Add(rect); //niepotzrebne
Data.PartOfSolution part = new Data.PartOfSolution();
part.Xlu = w1;
part.Ylu = h;
part.Xrd = w1 + rect.Width;
part.Yrd = h + rect.Height;
this.listPartOfSolution.Add(part);
w1 += rect.Width;
if (this.end == -1 || this.end > part.Yrd)//h + rect.Height)
this.end = part.Yrd;// h + rect.Height; //zapamietuje najglebsze wciecie!!!!!!
this.lastPartEnd = part.Xrd;
if (this.end2 < part.Yrd)
this.end2 = part.Yrd;
}
return true;
}
示例2: Move
//AI Stupid
void Move()
{
switch (currentDirection)
{
case direction.right:
sp.flipX = true;
if (timer < time)
{
timer += Time.deltaTime;
this.transform.Translate(Vector2.right * speed * Time.deltaTime);
}
else
{
timer = 0f;
currentDirection = direction.left;
}
break;
case direction.left:
sp.flipX = false;
if (timer < time)
{
timer += Time.deltaTime;
this.transform.Translate(Vector2.left * speed * Time.deltaTime);
}
else
{
timer = 0f;
currentDirection = direction.right;
}
break;
}
}
示例3: disableDirectionForTime
IEnumerator disableDirectionForTime(direction dir, float time){
if (dir == direction.RIGHT) rightDisabled = true;
else leftDisabled = true;
yield return new WaitForSeconds(time);
if (dir == direction.RIGHT) rightDisabled = false;
else leftDisabled = false;
}
示例4: Step
/// <summary>
/// prints the progress bar acorrding to pointers and current direction
/// </summary>
public override void Step()
{
if (this.currdir == direction.right)
{
this.PlacePointer(counter, this.pointer.Length);
this.counter++;
if (this.counter+this.pointer.Length == this.bar.Length)
this.currdir = direction.left;
}
else
{
this.PlacePointer(counter - this.pointer.Length, this.pointer.Length);
this.counter--;
if (this.counter == this.pointer.Length)
this.currdir = direction.right;
}
if (usepercent)
{
cur++;
Console.SetCursorPosition(8, 0);
Console.Write("{0}%", cur / max + 100);
}
Console.Write(this.bar + "\r");
}
示例5: Move
public void Move()
{
Vector3 position = gameObject.transform.position;
float newX = position.x;
switch (moveDiection)
{
case direction.left:
newX = position.x - Time.deltaTime * movementSpeed;
if (newX < minX)
{
moveDiection = direction.right;
}
else
{
position.x = newX;
}
break;
case direction.right:
newX = position.x + Time.deltaTime * movementSpeed;
if (newX > maxX)
{
moveDiection = direction.left;
}
else
{
position.x = newX;
}
break;
}
gameObject.transform.position = position;
}
示例6: Node
public Thread thread; //the algorithm thread it should run
#endregion Fields
#region Constructors
//CONSTRUCTOR: Initializes the color, the total number of nodes in the system, it's id, and its randomized starting position
public Node(Color c,int totalNodes,int id, int startingPosition)
{
//Initializes variables
replyNum = 0;
m_speed = 25;
m_color = c;
m_location = startingPosition;
m_size = totalNodes;
m_id = id;
m_timestamp = 0;
m_requestDeffered = new bool[m_size];
for (int j = 0; j < m_size; j++)
m_requestDeffered[j] = false;
leftCS = 0;
rightCS = 0;
dir = direction.left;
//Create the Node Image to display to the screen
m_image = new Bitmap(40, 40);
using (Graphics g = Graphics.FromImage(m_image))
{
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
//Draws the faded border around the dot
using (SolidBrush sb = new SolidBrush(Color.FromArgb(127, m_color)))
g.FillEllipse(sb, new Rectangle(0, 0, m_image.Width, m_image.Height));
//Draws the actual small dot centered with the faded border
g.FillEllipse(Brushes.Black, new Rectangle(m_image.Width / 2 - 2, m_image.Height / 2 - 2, 4, 4));
}
}
示例7: ChangeDirection
public int ChangeDirection()
{
string newDir = movementBuffer[bufferIndex];
if (newDir.ToLower().Equals("up"))
{
dir = direction.up;
}
else if (newDir.ToLower().Equals("down"))
{
dir = direction.down;
}
else if (newDir.ToLower().Equals("left"))
{
dir = direction.left;
}
else if (newDir.ToLower().Equals("right"))
{
dir = direction.right;
}
else //if (newDir.ToLower().Equals("stop") || newDir == null)
{
dir = direction.stop;
}
movementBuffer[bufferIndex] = "stop";
if (bufferIndex < 5)
{
bufferIndex++;
}
return (int)dir;
}
示例8: GetSymbolByDirection
public char GetSymbolByDirection(direction Direction)
{
if (Direction == direction.left) return Program.map[x - 1, y];
if (Direction == direction.right) return Program.map[x + 1, y];
if (Direction == direction.up) return Program.map[x, y - 1];
return Program.map[x, y + 1];
}
示例9: Update
void Update()
{
//Debug.Log(Input.GetAxis("PlayBall"));
if (rigidbody2D.velocity.x < 0)
{
direct = direction.left;
}
if (rigidbody2D.velocity.x > 0)
{
direct = direction.right;
}
if (!gameStarted && Input.GetAxis("PlayBall") > 0.1f)
{
float ran = Random.Range(0, 2);
if (ran > 1f)
transform.rotation = Quaternion.Euler(0, 0, 180);
else
transform.rotation = Quaternion.Euler(0, 0, 0);
gameStarted = true;
rigidbody2D.velocity = GlobalBallSpeed.GetBallSpeed(transform.rotation.eulerAngles.z);
}
else if(gameStarted)
{
if (transform.position.x > 15f)
{
GlobalBallSpeed.score.x++;
restartGame();
}
else if (transform.position.x < -15f)
{
GlobalBallSpeed.score.y++;
restartGame();
}
}
}
示例10: testcase
public testcase (string o, string p, string r, string e, direction d)
{
original = o;
pattern = p;
replacement = r;
expected = e;
direction = d;
}
示例11: StupidGhost
//Ghost constructor
public StupidGhost(int x, int y, direction Direction)
{
this.X = x;
this.Y = y;
currentStatePlace = Program.map.EmptySpace;
objectDirection = Direction;
Program.map.RenderChar(x, y, GetSymbol());
}
示例12: SmartGhost
//Ghost constructor
public SmartGhost(int x, int y, direction Direction)
{
this.X = x;
this.Y = y;
currentStatePlace = Program.map.Jewel;
objectDirection = Direction;
Program.map.RenderChar(x, y, GetSymbol());
}
示例13: move
public void move (direction direction)
{
//scanner = gameEngine.Instance.getScanner ();
//start_move ();
RichmanAnimator rplayer = character_stage.GetComponent<RichmanAnimator> () as RichmanAnimator;
coming_steps = Random.Range (1, 6);
rplayer.move (coming_steps);
player_status = status.MOVING;
}
示例14: SwayBar
public SwayBar()
: base()
{
this.bar = "| |";
this.pointer = "***";
this.blankPointer = this.BlankPointer();
this.currdir = direction.right;
this.counter = 1;
}
示例15: Flip
private void Flip()
{
currentDirection = (currentDirection == direction.LEFT) ? direction.RIGHT : direction.LEFT;
selfTransform.localScale = new Vector3(
(currentDirection == direction.LEFT) ? -initialScale.x : initialScale.x,
initialScale.y,
1
);
}