当前位置: 首页>>代码示例>>C#>>正文


C# Player.SetPosition方法代码示例

本文整理汇总了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;
	}
开发者ID:Vicra,项目名称:Tron,代码行数:26,代码来源:GameMotor.cs

示例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);
    }
开发者ID:ThaisCorreia,项目名称:Unity-Game_CollectFood,代码行数:32,代码来源:GameManager.cs

示例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);
    }
开发者ID:jfleschler,项目名称:Futile_TMX_Demo,代码行数:33,代码来源:MainGame.cs

示例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'));

	}
开发者ID:MoonCoral,项目名称:Game-Jam-Master,代码行数:54,代码来源:TileEngine.cs

示例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));
    }
开发者ID:maggardJosh,项目名称:SpiritGuard,代码行数:18,代码来源:SpawnPoint.cs

示例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");
    }
开发者ID:mxgmn,项目名称:GENW,代码行数:39,代码来源:World.cs

示例7: SpawnPlayer

 public void SpawnPlayer(Player p)
 {
     if (spawnPoints.Count == 0)
         p.SetPosition(0, 0);
     else
         p.SetPosition(spawnPoints[RXRandom.Int(spawnPoints.Count)].pos);
 }
开发者ID:maggardJosh,项目名称:OGREAT,代码行数:7,代码来源:World.cs

示例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);
 }
开发者ID:IhsanFajari14018,项目名称:Project_SnakeAndLadder,代码行数:9,代码来源:Snake.cs

示例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;
    }
开发者ID:Vicra,项目名称:Tron,代码行数:20,代码来源:GameMotor.cs

示例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);
 }
开发者ID:IhsanFajari14018,项目名称:Project_SnakeAndLadder,代码行数:9,代码来源:Ladder.cs


注:本文中的Player.SetPosition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。