Пример #1
0
    public void OnSpawnRequest(LemmingSpawnInfo info)
    {
        if (!isServer)
        {
            return;
        }
        var lemming = createLemming(info);

        NetworkServer.Spawn(lemming);
        var stateController = lemming.GetComponent <LemmingStateController>();

        GameEvents.Lemmings.LemmingSpawned.SafeInvoke(stateController);
        stateController.RpcInformTeam();
    }
Пример #2
0
    //Create Lemming
    private GameObject createLemming(LemmingSpawnInfo info)
    {
        GameObject obj = Instantiate(spawnable, info.position, Quaternion.identity);

        LemmingMovementController movController = obj.GetComponent <LemmingMovementController>();

        if (movController != null)
        {
            movController.SetDirection(info.startingMovementDirection);
            movController.SetForwardDirection(info.startingMovementDirection);
        }
        LemmingStateController stateController = obj.GetComponent <LemmingStateController>();

        if (stateController != null)
        {
            stateController.Team = info.team;
        }
        return(obj);
    }