コード例 #1
0
ファイル: PlayerPrefab.cs プロジェクト: Keraunic-Tonic/GJ2021
        private static void Callback(object obj)
        {
            if (sidePlayerPrefab >= 0)
            {
                switch (obj.ToString())
                {
                case "Delete":
                    Undo.RecordObject(KickStarter.settingsManager, "Delete player reference");
                    KickStarter.settingsManager.players.RemoveAt(sidePlayerPrefab);
                    break;

                case "SetAsDefault":
                    for (int i = 0; i < KickStarter.settingsManager.players.Count; i++)
                    {
                        KickStarter.settingsManager.players[i].isDefault = (i == sidePlayerPrefab);
                    }
                    break;

                case "EditStartData":
                    PlayerStartDataEditor.CreateNew(sidePlayerPrefab);
                    break;

                case "FindReferences":
                    PlayerPrefab playerPrefab = KickStarter.settingsManager.players[sidePlayerPrefab];
                    FindPlayerReferences(playerPrefab.ID, (playerPrefab != null) ? playerPrefab.playerOb.GetName() : "(Unnamed)");
                    break;

                default:
                    break;
                }
            }
        }
コード例 #2
0
        public static void CreateNew(int _playerIndex)
        {
            PlayerStartDataEditor window = EditorWindow.GetWindowWithRect <PlayerStartDataEditor> (new Rect(0, 0, 400, 150), true, "Player start data", true);

            window.titleContent.text = "Player start data";
            window.position          = new Rect(300, 200, 400, 150);

            window.Init(_playerIndex);
        }