コード例 #1
0
ファイル: PlayerControl.cs プロジェクト: AidanHockey5/GAM79
    public void CmdSpawn(SpawnClass sClass)
    {
        _currentClass = sClass;
        switch (sClass)
        {
        case global::SpawnClass.Technician:
            GameObject obj = (GameObject)Instantiate(CustomNetworkManager.Instance.spawnPrefabs [3], SpawnPointManager.Instance.SpawnPointLocation(1), Quaternion.identity);
            NetworkServer.Destroy(this.gameObject);
            NetworkServer.ReplacePlayerForConnection(this.connectionToClient, obj, this.playerControllerId);
            break;

        case global::SpawnClass.Support:
            GameObject obj2 = (GameObject)Instantiate(CustomNetworkManager.Instance.spawnPrefabs [0], SpawnPointManager.Instance.SpawnPointLocation(1), Quaternion.identity);
            NetworkServer.Destroy(this.gameObject);
            NetworkServer.ReplacePlayerForConnection(this.connectionToClient, obj2, this.playerControllerId);
            break;

        case global::SpawnClass.Heavy:
            GameObject obj3 = (GameObject)Instantiate(CustomNetworkManager.Instance.spawnPrefabs [4], SpawnPointManager.Instance.SpawnPointLocation(1), Quaternion.identity);
            NetworkServer.Destroy(this.gameObject);
            NetworkServer.ReplacePlayerForConnection(this.connectionToClient, obj3, this.playerControllerId);
            break;

        case global::SpawnClass.Assault:
            GameObject obj4 = (GameObject)Instantiate(CustomNetworkManager.Instance.spawnPrefabs [5], SpawnPointManager.Instance.SpawnPointLocation(1), Quaternion.identity);
            NetworkServer.Destroy(this.gameObject);
            NetworkServer.ReplacePlayerForConnection(this.connectionToClient, obj4, this.playerControllerId);
            break;
        }
    }
コード例 #2
0
ファイル: MonsterSpawn.cs プロジェクト: FlorentBaudon/Scout
    public void Spawn()
    {
        SpawnClass SpawnMonster = bestiaire[Random.Range(0, bestiaire.Length)];

        Vector3 rotation = new Vector3(SpawnMonster.rEuler.x + Random.Range(-15, 15), SpawnMonster.rEuler.y + Random.Range(-15, 15), SpawnMonster.rEuler.z + Random.Range(-15, 15));

        Instantiate(SpawnMonster.MonsterToSpawn, (SpawnMonster.spawnSphere[Random.Range(0, SpawnMonster.spawnSphere.Length - 1)].position), Quaternion.Euler(rotation));

        Invoke("Spawn", Random.Range(ApparitionMin, ApparitionMax));
    }
コード例 #3
0
ファイル: PlayerControl.cs プロジェクト: AidanHockey5/GAM79
    public void SpawnClass(SpawnClass sClass)
    {
        if (_currentClass != sClass)
        {
            CmdSpawn(sClass);
        }
        else
        {
            this.transform.position = SpawnPointManager.Instance.SpawnPointLocation(1);
        }

        GameManager.Instance.OnCharacterSpawn(sClass);
    }
コード例 #4
0
ファイル: GameManager.cs プロジェクト: AidanHockey5/GAM79
    public void OnCharacterSpawn(SpawnClass sClass)
    {
        int cost = 0;

        switch (sClass)
        {
        case SpawnClass.Technician:
        case SpawnClass.Support:
            cost = 1;
            break;

        case SpawnClass.Heavy:
        case SpawnClass.Assault:
            cost = 3;
            break;
        }
        UpdateTicketAmount(-(cost));
    }