public void pegarCaixa(Pegavel pegavel) { this.AoPegar.Invoke(); this._segurando = pegavel; this._segurando.pegar(this.pontoDeApoioCaixa); this.SendMessageUpwards("alterarComandoParaSoltarCaixa"); }
void Update() { RaycastHit hit; if (this._segurando == null) { if (Physics.Raycast(this.transform.position, this.transform.forward, out hit, this.distanciaMiminaParaPegar, 1 << 8)) { this.SendMessageUpwards("mostrarAtalhoLevantarCaixa"); if (Input.GetKeyDown(KeyCode.E)) { Pegavel pegavel = hit.transform.GetComponent <Pegavel> (); if (pegavel != null) { this.pegarCaixa(pegavel); } } } else { this.SendMessageUpwards("esconderAtalhoLevantarCaixa"); } } else { if (Input.GetKeyDown(KeyCode.E)) { this.soltarCaixa(); } } this.transform.rotation = this.controleCamera.rotation; }
private void _fixar(Transform cubo) { Pegavel pegavel = cubo.GetComponent <Pegavel> (); if (pegavel.ligada) { pegavel.SendMessageUpwards("soltarCaixa"); } cubo.transform.parent = this.posicao; cubo.localPosition = Vector3.zero; cubo.localRotation = this.posicao.localRotation; cubo.GetComponent <Rigidbody> ().Sleep(); pegavel.soltar(); this._ocupante = cubo.gameObject; }
public void soltarCaixa() { this._segurando.soltar(); this._segurando = null; this.SendMessageUpwards("alterarComandoParaPegarCaixa"); }