Exemplo n.º 1
0
    public spawnInfo getSpawn(int connectionId)
    {
        Player            p     = players[connections.Find(id => id == connectionId)];
        GameObject        spawn = spawns[p.spawnInd];
        NetworkInstanceId sid   = spawn.GetComponent <NetworkIdentity>().netId;
        //print(sid);
        //for (uint i = 0; i < 10; i++)
        //{
        //    print(i + "  sev  " + NetworkServer.FindLocalObject(new NetworkInstanceId(i)));
        //}
        spawnInfo si = new spawnInfo(sid, p.team);

        return(si);
    }
Exemplo n.º 2
0
    void Update()
    {
        for (int i = 0; i < spawningLines.Count; i++)
        {
            currLine = spawningLines[i];
            if (currLine.spawnIndex >= currLine.spawnAmount)
            {
                spawningLines.RemoveAt(i);
                levelScript.finishedPhase();
                i--;//to compensate for the list reducing in size.
                continue;
            }

            if (currLine.spawnTimer >= currLine.spawnPeriod)
            {
                var enemy = Instantiate(currLine.enemy, transform.position, Quaternion.identity, transform);
                if (transform.rotation.z != 0)
                {
                    enemy.transform.localScale = new Vector3(enemy.transform.localScale.x, (enemy.transform.localScale.y / 3), enemy.transform.localScale.z);
                    enemy.transform.position   = new Vector3(enemy.transform.position.x, (enemy.transform.position.y + Random.Range(-1f, 1f)), enemy.transform.position.z);
                }
                else
                {
                    enemy.transform.localScale = new Vector3((enemy.transform.localScale.x / 3), enemy.transform.localScale.y, enemy.transform.localScale.z);
                    enemy.transform.position   = new Vector3((enemy.transform.position.x + Random.Range(-1f, 1f)), enemy.transform.position.y, enemy.transform.position.z);
                }
                enemy.GetComponent <DijkstraPath>().mapObject  = levelScript.dijkstraMap;
                enemy.GetComponent <Monster>().LevelController = levelController;
                enemy.GetComponent <Monster>().splatterEffects = splatterEffects;
                levelScript.spawnEnemy(currLine.progressCost / currLine.spawnAmount);
                currLine.spawnTimer = 0;
                currLine.spawnIndex++;
            }
            currLine.spawnTimer += Time.deltaTime;
        }
    }