Esempio n. 1
0
        static void Pick(string tid)
        {
            var obj = WorldUtils.FindObjectByTID(tid);

            if (obj == null)
            {
                ConsoleModule.WriteLine("Couldn't find TID!");
                return;
            }
            if (obj.GetComponent <BaseController>() == null)
            {
                ConsoleModule.WriteLine("Ref has no controller!");
            }

            SelectedTID    = tid;
            SelectedObject = obj;

            ConsoleModule.WriteLine("Found TID: " + tid);
        }
Esempio n. 2
0
        private void RestorePlayerToIntent(MetaState mgs, GameObject player)
        {
            if (mgs.PlayerIntent != null)
            {
                if (!string.IsNullOrEmpty(mgs.PlayerIntent.SpawnPoint))
                {
                    GameObject spawnPoint = WorldUtils.FindObjectByTID(mgs.PlayerIntent.SpawnPoint);
                    player.transform.position = spawnPoint.transform.position;
                    player.transform.rotation = spawnPoint.transform.rotation;
                }
                else if (mgs.PlayerIntent.SpawnPoint != null) //not null, but is empty
                {
                    GameObject spawnPoint = WorldUtils.FindObjectByTID("DefaultPlayerSpawn");
                    if (spawnPoint != null)
                    {
                        player.transform.position = spawnPoint.transform.position;
                        player.transform.rotation = spawnPoint.transform.rotation;
                    }
                }
                else
                {
                    player.transform.position = mgs.PlayerIntent.Position;
                    player.transform.rotation = mgs.PlayerIntent.Rotation;
                }
            }
            else
            {
                GameObject spawnPoint = WorldUtils.FindObjectByTID("DefaultPlayerSpawn");
                if (spawnPoint != null)
                {
                    player.transform.position = spawnPoint.transform.position;
                    player.transform.rotation = spawnPoint.transform.rotation;
                }

                Debug.LogWarning("No player spawn intent exists!");
            }
        }