Beispiel #1
0
    public void RpcSetInformation(int characterId, bool murderer)
    {
        this.murderer = murderer;
        this.mySpec   = listOfCharacters.GetCharacterById(characterId);
        if (mySpec == null)
        {
            return;
        }
        if (isLocalPlayer)
        {
            //Call all client's clue spawners with list of current players
            GameObject clueController = GameObject.Find("ClueController");
            Debug.Log("MY NAME == " + mySpec.FullName.ToString());
            Debug.Log("Am I murderer? " + this.murderer);

            /*if (clueController != null)
             * {
             *  clueController.GetComponent<ClueSpawner>().ChangeToPrivateText();
             *  Debug.Log("____________going to spawn clues stuff");
             * }
             * else
             * {
             *  Debug.Log("____________bad stuff");
             * }*/
            //if (murderer)
//{
            //     GameObject.Find("MT").transform.GetChild(0).gameObject.SetActive(true);
//}
        }
    }
Beispiel #2
0
    public GameObject InstantiateCharacter(CharacterSpec spec, GameObject backupPrefab, Transform t)
    {
        GameObject prefab = spec.PlayablePrefab ?? backupPrefab;
        GameObject temp   = Instantiate(prefab);

        temp.transform.position = t.position;
        return(temp);
    }
Beispiel #3
0
    public void AddCharacter(int id)
    {
        CharacterSpec spec = list.GetCharacterById(id);

        if (spec == null)
        {
            return;
        }
        charactersPlaying[id] = spec;
    }
    public override void OnServerAddPlayer(NetworkConnection conn, short playerControllerId, NetworkReader extraMessageReader)
    {
        if (playerSpawnDict == null)
        {
            AssignSpawns(storyNum);
        }
        if (extraMessageReader == null)
        {
            return;
        }
        PlayerJoinMessage message = extraMessageReader.ReadMessage <PlayerJoinMessage>();

        if (message == null)
        {
            return;
        }
        if (playerManager.IsPlayerJoined(message.characterId))
        {
            return;
        }
        connectionIdCharacterId.Add(conn.connectionId, (int)message.characterId);
        playerManager.AddCharacter((int)message.characterId);
        CharacterSpec spec = playerManager
                             .FindCharacterSpecById((int)message.characterId);
        GameObject player;

        if (spec != null)
        {
            player = playerManager.InstantiateCharacter(spec, playerPrefab, GetPlayerSpawn(spec.FullName));
        }
        else
        {
            player = Instantiate(playerPrefab);
            player.transform.position = GetStartPosition().position;
        }
        NetworkServer.AddPlayerForConnection(conn, player, playerControllerId);
        Debug.Log("network server adding player");
        //rpc call to all clients to assign info to prefabs
        if (spec != null)
        {
            SpawnAllServerAndClientClues(player);
            if (spec.FullName == this.murderer)
            {
                player.GetComponent <Player>().RpcSetInformation((int)message.characterId, true);
                player.GetComponent <Player>().SetMurderer(true);
            }
            else
            {
                player.GetComponent <Player>().RpcSetInformation((int)message.characterId, false);
            }
        }
    }
Beispiel #5
0
    // Use this for initialization
    void Start()
    {
        selectingCharacter = 0;
        selected = false;
        time = 0;

        characterSpecs[0] = new CharacterSpec(3, 4, 3, "Balanced Unitychan", new Color(1, 1, 1));
        characterSpecs[1] = new CharacterSpec(2, 3, 5, "Power Unitychan", new Color(0.9f, 0.4f, 0.4f));
        characterSpecs[2] = new CharacterSpec(5, 2, 3, "Sonic Unitychan", new Color(0.4f, 0.4f, 0.9f));
        characterSpecs[3] = new CharacterSpec(3, 5, 2, "Endurant Unitychan", new Color(0.4f, 0.9f, 0.4f));

        ToggleDisplay();
    }
 public void SetCharacter(CharacterSpec spec, bool selected = false)
 {
     fullName.text = spec.FullName;
     this.selected = selected;
     if (characterModel == null)
     {
         characterModel = Instantiate(spec.CharacterModelPrefab);
         characterId    = spec.Id;
         characterModel.transform.parent      = model.transform;
         characterModel.transform.position    = model.transform.position;
         characterModel.transform.localScale *= modelScale;
         characterModel.transform.rotation    = Quaternion.Euler(0, 180, 0);
     }
     UpdateSelected(selected);
 }
 // Use this for initialization
 void Start()
 {
     clueReference = new Dictionary <CluePlaceholder, GameObject>();
     SetActiveContatiner();
     SpawnGeneralClues();
     localSpec = null;
     beginningTextContainer = GameObject.Find("BeginningText");
     netManager             = NetworkManager.singleton as OMGNetManager;
     //get local spec
     GetLocalSpec();
     //change to private text
     ChangeToPrivateText();
     //remove non-local player intro texts
     RemoveIntroTexts();
 }
Beispiel #8
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.LeftArrow))
        {
            if (selectingCharacter == 0) selectingCharacter = CharacterNum - 1;
            else selectingCharacter--;

            ToggleDisplay();
        }
        else if (Input.GetKeyDown(KeyCode.RightArrow))
        {
            if (selectingCharacter == CharacterNum - 1) selectingCharacter = 0;
            else selectingCharacter++;

            ToggleDisplay();
        }
        else if (Input.GetKeyDown(KeyCode.Space))
        {
            //キャラクター決定
            selected = true;
            selectNotify.GetComponent<Text>().enabled = false;
            SelectedCharacter = characterSpecs[selectingCharacter];
        }

        if (selected)
        {
            time += Time.deltaTime;
            if (time > 0.4f)
            {
                time = 0;
                notifyText.GetComponent<Text>().enabled = !notifyText.GetComponent<Text>().enabled;
            }

            Application.LoadLevel("LevelDesignTest");
        }
    }
    //loop through players to find local one and assign spec
    private void GetLocalSpec()
    {
        int characterId = Settings.gameSettings.CharacterId;

        localSpec = netManager?.playerManager.list.GetCharacterById(characterId);
    }