private void OnDeselectInteractable(TEntity master, ITInteractable interactable) { interactable.Widget.SetActive(false); //I would have not done that on a true project. for (int i = 0; i < interactable.SpriteRenderers.Length; i++) { Transform t = interactable.SpriteRenderers[i].transform.Find(SELECTION_DISPLAYER_NAME); if (t != null) { Destroy(t.gameObject); } } }
private void Awake() { CreateComponents(); for (int i = 0; i < _components.Count; i++) { _components[i].OnAwake(); } //In a real game, I would have made an entity manager for this kind of reference. if (_isPlayer == true) { Player = this; } //I would have done a separate component for money in a real game _money = _startMoney; }
private void OnSelectInteractable(TEntity master, ITInteractable interactable) { interactable.Widget.SetActive(true); //I would never have not done that on a true project. for (int i = 0; i < interactable.SpriteRenderers.Length; i++) { GameObject selectionDisplay = new GameObject(SELECTION_DISPLAYER_NAME); selectionDisplay.transform.SetParent(interactable.SpriteRenderers[i].transform); selectionDisplay.transform.localPosition = default; selectionDisplay.transform.localRotation = default; selectionDisplay.transform.localScale = Vector3.one * 1.05f; SpriteRenderer rend = selectionDisplay.AddComponent <SpriteRenderer>(); rend.sprite = interactable.SpriteRenderers[i].sprite; rend.color = Color.black; TSpriteOrderer orderer = selectionDisplay.AddComponent <TSpriteOrderer>(); orderer.SetOrderInLayerForcedOffset(-1); } }
public override TEntityComponent BuildInstance(TEntity master) { return(new TEntityAnimations(this, master)); }
public TEntityAnimations(TEntityAnimationsComponent data, TEntity master) : base(data, master) { _data = data; }
public override TEntityComponent BuildInstance(TEntity master) { return(new TEntityController(this, master)); }
public TEntityController(TEntityControllerComponent data, TEntity master) : base(data, master) { _data = data; }
public TEntityVisual(TEntityVisualComponent data, TEntity master) : base(data, master) { _data = data; }
public override TEntityComponent BuildInstance(TEntity master) { return(new TEntityMovements(this, master)); }
public TEntityMovements(TEntityMovementsComponent data, TEntity master) : base(data, master) { _data = data; }
private void OnStartInteract(TEntity master, ITInteractable interactable) { References.Rigidbody.velocity = Vector2.zero; _movementDirection = TMovementDirection.None; }
private void OnValidate() { _master = GetComponent <TEntity>(); }
public virtual TEntityComponent BuildInstance(TEntity master) { return(new TEntityComponent(this, master)); }
public TEntityComponent(TEntityComponentBase data, TEntity master) { _data = data; _master = master; }
public TEntityInteractions(TEntityInteractionsComponent data, TEntity master) : base(data, master) { _data = data; }