本文整理汇总了C#中Player.SetPosition方法的典型用法代码示例。如果您正苦于以下问题:C# Player.SetPosition方法的具体用法?C# Player.SetPosition怎么用?C# Player.SetPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Player
的用法示例。
在下文中一共展示了Player.SetPosition方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GameMotor
public GameMotor(int xSize, int ySize)
{
_gameBoard = new char[xSize][];
for (int i = 0; i < xSize; i++)
{
_gameBoard[i] = new char[ySize];
}
for (int i = 0; i < xSize; i++)
{
for (int j = 0; j < ySize; j++)
{
_gameBoard[i][j] = _cleanSpot;
}
}
PlayerRed = new Player('▒', 'R');
PlayerBlue = new Player('▓','B');
PlayerRed.SetPosition(Tuple.Create(0,0));
PlayerBlue.SetPosition(Tuple.Create(xSize-1,ySize-1));
_gameBoard[0][0] = PlayerRed.PlayerCharacter;
_gameBoard[xSize-1][ySize-1] = PlayerBlue.PlayerCharacter;
}
示例2: Start
public void Start()
{
manager = GameObject.Find("Manager").GetComponent<LevelManager>();
player = GameObject.Find("Player").GetComponent<Player>();
initialPosition = new Vector3(7.5f,0.73f,-8.9f);
player.SetPosition(initialPosition);
player.SetRotation(new Quaternion(0f,0f,0f,0));
gameOver = false;
xLimit1 = -10.8f;
xLimit2 = 8f;
yLimit1 = 0.3f;
yLimit2 = 4f;
zLimit1 = -9.5f;
zLimit2 = 9.5f;
radiusFood = 0.5f;
counter = 0f;
previousCounter = 0f;
foodObjects = new string[]{"FoodApple","FoodBanana","FoodCandyCane"};
timerLimit = 2.0f;
timer = timerLimit;
player.SetActive(true);
CreateFoodObjects(foodQty);
}
示例3: Start
// Use this for initialization
void Start()
{
FutileParams fParams = new FutileParams(true,true,false,false);
fParams.AddResolutionLevel(640.0f,2.0f,1.0f,"");
fParams.origin = new Vector2(0,0);
Futile.instance.Init(fParams);
Futile.atlasManager.LoadAtlas("Atlases/spritesheet");
Futile.stage.shouldSortByZ = true;
// this is the tmx file located in Resources/TileMaps
currentLevel = new Level("demo");
Futile.stage.AddChild(currentLevel);
player = new Player();
player.sortZ = 69f;
// find spawn point in collision layer
int lengthI = currentLevel.Grid_Collision.GetLength(0);
int lengthJ = currentLevel.Grid_Collision.GetLength(1);
for (int i = 0; i < lengthI; i++) {
for (int j = 0; j < lengthJ; j++) {
if (currentLevel.Grid_Collision[i, j] == 16) {
player.SetPosition(new Vector2(j * 16 + 8, (-i * 16)));
break;
}
}
}
currentLevel.AddChild(player);
}
示例4: Awake
// Use this for initialization
void Awake () {
getReward = new bool[] {false, false, false, false, false};
inventory = new GameObject[4]; // 4 = user inventory capacity
player = FindObjectOfType<Player>();
objectList = new Dictionary<string, Dictionary<GameObject, Vector3>>();
rules = new Dictionary<string, string[]>();
mapData = mapBG.text.Split('\n');
int i = 0;
if (!this.transform.FindChild ("Background")) {
GameObject bg = new GameObject ();
bg.name = "Background";
bg.transform.parent = this.transform;
}
//Background objects/walls come first
while (i < mapData.Length) {
string line = mapData[i];
if (line[0].Equals('-')) {
i++;
break;
}
for (int j=0; j< line.Length; j++) {
GameObject tile;
if (line[j].Equals('p')) {
player.SetPosition(new Vector3 (j, -i, -1));
tile = floor1;
} else {
tile = getTile (line[j]);
}
if (tile != null) {
Vector3 pos = new Vector3 (j,-i,0.3f);
GameObject test = (GameObject)Instantiate(tile, pos, transform.rotation);
test.transform.parent = transform.FindChild("Background");
}
}
i++;
}
//Add in the Objects
CreateRoom (map0.text.Split ('\n'));
CreateRoom (map1.text.Split ('\n'));
CreateRoom (map2.text.Split ('\n'));
CreateRoom (map3.text.Split ('\n'));
CreateRoom (map4.text.Split ('\n'));
}
示例5: SpawnPlayer
public void SpawnPlayer(Player p)
{
p.SetPosition(pos-new Vector2(p.hitBox.x, p.hitBox.y));
p.SetDirection(exitDirection);
p.PlayAnim(true);
p.xVel = 0;
p.yVel = 0;
Vector2 newPos = p.GetPosition();
switch(exitDirection)
{
case FutileFourDirectionBaseObject.Direction.UP: newPos.y += 20; break;
case FutileFourDirectionBaseObject.Direction.RIGHT: newPos.x += 16; break;
case FutileFourDirectionBaseObject.Direction.DOWN: newPos.y -= 16; break;
case FutileFourDirectionBaseObject.Direction.LEFT: newPos.x -= 16; break;
}
Go.to(p, 1.0f, new TweenConfig().floatProp("x", newPos.x).floatProp("y", newPos.y));
}
示例6: Load
public void Load()
{
Log.Write("loading the world... ");
XmlNode xnode = MyXml.SecondChild("Data/world.xml");
Log.Assert(xnode.Name == "map", "wrong world file format");
int width = MyXml.GetInt(xnode, "width");
int height = MyXml.GetInt(xnode, "height");
map.margin.x = MyXml.GetInt(xnode, "vMargin");
map.margin.y = MyXml.GetInt(xnode, "hMargin");
string method = MyXml.GetString(xnode, "method");
map.Load(width, height, method);
xnode = xnode.NextSibling;
camera = new ZPoint(MyXml.GetInt(xnode, "x"), MyXml.GetInt(xnode, "y"));
player = new Player();
player.SetPosition(camera, 0.01f);
player.UpdateVisitedLocations();
for (xnode = xnode.NextSibling.FirstChild; xnode != null; xnode = xnode.NextSibling)
{
GlobalObject o = new GlobalObject(BigBase.Instance.gShapes.Get(MyXml.GetString(xnode, "name")));
o.uniqueName = MyXml.GetString(xnode, "uniqueName");
string dialogName = MyXml.GetString(xnode, "dialog");
if (dialogName != "") o.dialog = BigBase.Instance.dialogs.Get(dialogName);
o.SetPosition(new HexPoint(MyXml.GetInt(xnode, "x"), MyXml.GetInt(xnode, "y")), 0.01f);
for (XmlNode xitem = xnode.FirstChild; xitem != null; xitem = xitem.NextSibling)
o.inventory.Add(new Item(MyXml.GetString(xitem, "name"), MyXml.GetInt(xitem, "amount", 1)));
gObjects.Add(o);
}
Log.WriteLine("OK");
}
示例7: SpawnPlayer
public void SpawnPlayer(Player p)
{
if (spawnPoints.Count == 0)
p.SetPosition(0, 0);
else
p.SetPosition(spawnPoints[RXRandom.Int(spawnPoints.Count)].pos);
}
示例8: MovePlayer
/// <summary>
/// Method override untuk memindahkan player
/// </summary>
/// <param name="p"> Player yang ingin dipindahkan</param>
public override void MovePlayer(Player p)
{
//set posisi pemain pada tail
p.SetPosition(Tail);
}
示例9: MakeMove
public Player MakeMove(Player toMove, Tuple<int, int> direction)
{
var previousPosition = toMove.GetPosition();
var nextPosition = CalculateNewPosition(previousPosition, direction);
var playerCollided = VerifyMove(nextPosition);
if (!playerCollided)
{
toMove.KillPlayer();
}
else
{
toMove.SetPosition(nextPosition);
MarkCoordinates(toMove,previousPosition,nextPosition);
}
var playedAlive = VerifyPlayerAlive();
return playedAlive;
}
示例10: MovePlayer
///<summary>
///Method override untuk memindahkan player
///</summary>
///<param name="p">Pemain yang akan dipindahkan</param>
public override void MovePlayer(Player p)
{
//set posisi pemain pada head
p.SetPosition(Head);
}