Beispiel #1
0
    public void RemovePlayerShip(PlayerID player)
    {
        totalPlayers--;

        ShipConfigData config = new ShipConfigData();

        config.playerID = PlayerID.none;
//		config.ship = shipType;

        switch (player)
        {
        case PlayerID.P1:
            player1Config = config;
            return;

        case PlayerID.P2:
            player2Config = config;
            return;

        case PlayerID.P3:
            player3Config = config;
            return;

        case PlayerID.P4:
            player4Config = config;
            return;
        }
    }
Beispiel #2
0
    public void SetPlayerShip(PlayerID player, ShipType shipType)
    {
        totalPlayers++;

        ShipConfigData config = new ShipConfigData();

        config.playerID = player;
        config.ship     = shipType;

        switch (player)
        {
        case PlayerID.P1:
            player1Config = config;
            return;

        case PlayerID.P2:
            player2Config = config;
            return;

        case PlayerID.P3:
            player3Config = config;
            return;

        case PlayerID.P4:
            player4Config = config;
            return;
        }
    }
Beispiel #3
0
    void SpawnShip(ShipConfigData config)
    {
        Debug.Log(planets[planetID]);
        while (!planets[planetID].playerSpawnPoints[playerSpawnID].isAvailable)
        {
            MoveSpawnPoint();
        }

//		PlayerConfig playerConfig = Instantiate(GetShipPrefab(config.ship),spawnPoints[spawnID].position, Quaternion.identity) as PlayerConfig;
        GameObject go = Instantiate(GetShipPrefab(config.ship), planets[planetID].playerSpawnPoints[playerSpawnID].gameObject.transform.position, Quaternion.identity) as GameObject;

        go.GetComponent <PlayerConfig>().Configure(config.playerID, totalPlayers);

        MoveSpawnPoint();

        //regenerate the list of players
        players = null;
        players = GameObject.FindGameObjectsWithTag("Player");
    }
	public void RemovePlayerShip(PlayerID player) {
		totalPlayers--;

		ShipConfigData config = new ShipConfigData();
		config.playerID = PlayerID.none;
//		config.ship = shipType;

		switch (player) {
		case PlayerID.P1:
			player1Config = config;
			return;
		case PlayerID.P2:
			player2Config = config;
			return;
		case PlayerID.P3:
			player3Config = config;
			return;
		case PlayerID.P4:
			player4Config = config;
			return;
		}
	}
	public void SetPlayerShip(PlayerID player, ShipType shipType) {
		totalPlayers++;

		ShipConfigData config = new ShipConfigData();
		config.playerID = player;
		config.ship = shipType;

		switch (player) {
		case PlayerID.P1:
			player1Config = config;
			return;
		case PlayerID.P2:
			player2Config = config;
			return;
		case PlayerID.P3:
			player3Config = config;
			return;
		case PlayerID.P4:
			player4Config = config;
			return;
		}

	}
	void SpawnShip(ShipConfigData config) {
		Debug.Log( planets[planetID]);
		while (!planets[planetID].playerSpawnPoints[playerSpawnID].isAvailable) {
			MoveSpawnPoint ();
		}
			
//		PlayerConfig playerConfig = Instantiate(GetShipPrefab(config.ship),spawnPoints[spawnID].position, Quaternion.identity) as PlayerConfig;
		GameObject go = Instantiate(GetShipPrefab(config.ship),planets[planetID].playerSpawnPoints[playerSpawnID].gameObject.transform.position, Quaternion.identity) as GameObject;

		go.GetComponent<PlayerConfig>().Configure(config.playerID, totalPlayers);

		MoveSpawnPoint();

		//regenerate the list of players
		players = null;
		players = GameObject.FindGameObjectsWithTag("Player");
	}
	IEnumerator SpawnDelay(ShipConfigData config) {
		yield return new WaitForSeconds(spawnDelay);

		SpawnShip(config);
	}
Beispiel #8
0
    IEnumerator SpawnDelay(ShipConfigData config)
    {
        yield return(new WaitForSeconds(spawnDelay));

        SpawnShip(config);
    }