private void InstantiateGridWithGeneric() { if (!_debug) { return; } _debugTextArray = new TextMesh[Width, Height]; for (var x = 0; x < Width; x++) { for (var y = 0; y < Height; y++) { _debugTextArray[x, y] = WorldText.Create(_gridArray[x, y].ToString(), null, GetWorldPosition(x, y) + new Vector3(TileSize, 0, TileSize) * .5f, new Vector3(), true, 60, null, TextAnchor.MiddleCenter, TextAlignment.Center); Debug.DrawLine(GetWorldPosition(x, y), GetWorldPosition(x, y + 1), Color.grey, Mathf.Infinity); Debug.DrawLine(GetWorldPosition(x, y), GetWorldPosition(x + 1, y), Color.grey, Mathf.Infinity); } } Debug.DrawLine(GetWorldPosition(Width, Height), GetWorldPosition(Width, 0), Color.grey, Mathf.Infinity); Debug.DrawLine(GetWorldPosition(Width, Height), GetWorldPosition(0, Height), Color.grey, Mathf.Infinity); ONGridObjectChanged += (_, eventArgs) => _debugTextArray[eventArgs.X, eventArgs.Y].text = _gridArray[eventArgs.X, eventArgs.Y]?.ToString(); }
public void DestroyModelNameplate() { if (mWorldModelName == null) { return; } WorldFrame.Instance.WorldTextManager.RemoveText(mWorldModelName); mWorldModelName.Dispose(); mWorldModelName = null; }
private void Add3DText_Click(object sender, RoutedEventArgs e) { var worldText = new WorldText { Position = WorldFrame.Instance.ActiveCamera.Position, Text = "This is a 3D text!", DrawMode = WorldText.TextDrawMode.TextDraw3D }; WorldFrame.Instance.WorldTextManager.AddText(worldText); }
protected void Start() { if (_pfHealFX == null) _pfHealFX = Resources.Load<ParticleSystem>("Prefabs/Heal"); if (_pfLevelUpFX == null) _pfLevelUpFX = Resources.Load<ParticleSystem>("Prefabs/LevelUpFx"); if (_pfDamageText == null) _pfDamageText = Resources.Load<WorldText>("Prefabs/DamageText"); if (_pfHealText == null) _pfHealText = Resources.Load<WorldText>("Prefabs/HealText"); if (isServer) InvokeRepeating("PeriodicSync", UnityEngine.Random.Range(0f, 5f), 5f); }
public void CreateModelNameplate() { if (mWorldModelName != null) { return; } mWorldModelName = new WorldText { Text = mModel.ModelName, Scaling = 1.0f, DrawMode = WorldText.TextDrawMode.TextDraw3D }; UpdateModelNameplate(); WorldFrame.Instance.WorldTextManager.AddText(mWorldModelName); }
public void CreateModelNameplate() { if (mWorldModelName != null) { return; } mWorldModelName = new WorldText { Text = System.IO.Path.GetFileName(ModelRoot.FileName), Scaling = 1.0f, DrawMode = WorldText.TextDrawMode.TextDraw3D }; UpdateModelNameplate(); WorldFrame.Instance.WorldTextManager.AddText(mWorldModelName); }
private async Task OnTick() { var position = Cache.Player.Entity.Position; var distance = position.Distance(Position, true); if (distance < 5.0) { WorldText.Draw($"{(Item.IsWeapon() ? "Vapen" : "Föremål")}: {Item.Label}", 1f, Position); IsAccessible = true; await Task.FromResult(0); } else { IsAccessible = false; await BaseScript.Delay(Convert.ToInt32(distance * 2)); } }
private void Awake() { // Check if instance already exists, if there isn't set instance to this otherwise destroy this. if (instance == null) { instance = this; message = GetComponentInChildren <Text>(); image = transform.GetChild(0).GetComponent <RectTransform>(); retryButton = transform.GetChild(1).GetComponentInChildren <Image>(); retryText = transform.GetChild(1).GetComponentInChildren <Text>(); } else if (instance != this) { Destroy(gameObject); } // Persistant between scene loading DontDestroyOnLoad(gameObject); }
private async Task OnTick() { var removal = new List <ActionMessage>(); foreach (var message in Messages) { message.Ticks++; if (message.Ticks >= 15000) { removal.Add(message); continue; } if (string.IsNullOrEmpty(message.Message)) { continue; } var ped = API.GetPlayerPed(API.GetPlayerFromServerId(message.Sender)); if (!API.DoesEntityExist(ped)) { continue; } WorldText.Draw($"* {message.Message}", 1f, API.GetEntityCoords(ped, false).ToPosition()); } foreach (var entry in removal) { Messages.RemoveAll(self => self.Seed == entry.Seed); } await Task.FromResult(0); }
protected void Start() { if (_pfHealFX == null) _pfHealFX = Resources.Load<ParticleSystem>("Prefabs/Heal"); if (_pfLevelUpFX == null) _pfLevelUpFX = Resources.Load<ParticleSystem>("Prefabs/LevelUpFx"); if (_pfDamageText == null) _pfDamageText = Resources.Load<WorldText>("Prefabs/DamageText"); if (_pfHealText == null) _pfHealText = Resources.Load<WorldText>("Prefabs/HealText"); if (isServer) InvokeRepeating("PeriodicSync", UnityEngine.Random.Range(0f, 5f), 5f); }