public override bool Use(GameObject caller) { //Check if we are within a container var chests = GameObject.FindGameObjectsWithTag("Chest"); Container container = null; foreach (var chest in chests) { var cont = chest.GetComponent <Container>(); if (cont != null && cont.playerNearby) { container = cont; } } if (container != null) { if (container.KeyType == KeyType) { container.OpenContainer(); return(true); } } // We were unable to use the key return(false); }
public override void FinishExecution() { if (m_container != null && m_parent != null) { m_container.OpenContainer(); if (!DeactiveContainerIfEmpty() && m_activateCount > 0 && m_container.IsEmptyCheckWithoutMonster()) { m_activateCount--; m_parent.DecreaseActivate(m_commandIndex); } } base.FinishExecution(); }
public void UnPack() { if (!packed) { return; } packed = false; Enable(); //Affiche un feedback pour signaler que le bloc est inactif if (container.closed == true) { container.OpenContainer(); } ToggleVisuals(true); }