private void Awake() { _root = transform.GetChild(0).gameObject; _initRootPosition = _root.transform.localPosition; _framelessRootPosition = _initRootPosition + _framelessOffset; DoorBase = _root.transform.Find(DoorBaseName).gameObject; _doorHandle = _root.transform.Find(DoorHandleName).gameObject; _doorHandleBase1 = _root.transform.Find(DoorHandleBase1Name).gameObject; _doorHandleBase2 = _root.transform.Find(DoorHandleBase2Name).gameObject; _frames1 = _root.transform.Find(Frames1Name).gameObject; _frames2 = _root.transform.Find(Frames2Name).gameObject; _nameplate = _root.transform.Find(NameplateName).gameObject; _bellButton = _root.transform.Find(BellButtonName).gameObject; _bellBase = _root.transform.Find(BellBaseName).gameObject; _initBellBasePosition = _bellBase.transform.localPosition; _initBellButtonPosition = _bellButton.transform.localPosition; _framelessBellBasePosition = _initBellBasePosition - _framelessOffset; _framelessBellButtonPosition = _initBellButtonPosition - _framelessOffset; _pad = _root.transform.Find(PadName).gameObject; _tape = _root.transform.Find(TapeName).gameObject; _peephole = SelectableObject.GetAsChild <SwitchableObject>(_root, PeepholeName); _pushableDetails = transform.GetComponentsInChildren <DoorPushableDetail>(); _nameplateMatComponent = _nameplate.GetComponent <MeshRenderer>().material; Randomize(); }
private void Start() { _door = SelectableObject.GetAsChild(gameObject, ESwitchableObjectId.GARBAGE_CHUTE_DOOR); _hinge = SelectableObject.GetAsChild(gameObject, ESwitchableObjectId.GARBAGE_CHUTE_DOOR_HINGE); _elevatorButtonPanel = SelectableObject.GetAsChild(gameObject, EInventoryItemId.ELEVATOR_CALLER_PANEL); _doorRigidbody = transform.Find("rigid_garbage_chute_door").GetComponent <Rigidbody>(); _door.InitStateSafeDistanceToPlayer = InitStateSafeDistanceToPlayer; _hinge.InitStateSafeDistanceToPlayer = InitStateSafeDistanceToPlayer; GameObject doorRigidbodyGameObject = _doorRigidbody.gameObject; _doorRigidbodyInitPosition = doorRigidbodyGameObject.transform.localPosition; _doorRigidbodyInitRotation = doorRigidbodyGameObject.transform.localRotation; _hinge.OpenCondition = () => !_door.IsOpened; _hinge.Opened += OnUnhinged; }
private void Start() { _connector = SelectableObject.GetAsChild(gameObject, ESwitchableObjectId.ELEVATOR_CALLER_CONNECTOR); _panel = SelectableObject.GetAsChild(_connector.gameObject, ESwitchableObjectId.ELEVATOR_CALLER_PANEL); _commonWires = SelectableObject.GetAsChild(_connector.gameObject, ESwitchableObjectId.ELEVATOR_CALLER_WIRES); _button = SelectableObject.GetAsChild <PushableObject>(_panel.gameObject, "button"); _connectorWires = _connector.transform.Find("connector_static_wires").gameObject; _connector.Clicked += OnConnectorClicked; _connector.Closed += OnConnectorClosed; _panel.Clicked += OnPanelClicked; _panel.Closed += OnPanelClosed; _panel.OpenAnimationCompleted += OnPanelOpenAnimationCompleted; _commonWires.Opened += OnWiresConnectedWithTape; _button.Opened += OnButtonClicked; }
private void Start() { _postboxBaseMaterial = transform.Find("postbox/postbox-base").GetComponent <MeshRenderer>().material; _leftDoor = transform.Find("left_door_prefab").GetComponent <Door>(); _rightDoor = transform.Find("right_door_prefab").GetComponent <Door>(); _scalpel = SelectableObject.GetAsChild <Scalpel>(gameObject, EInventoryItemId.SCALPEL); _ePanelDoor = SelectableObject.GetAsChildByPath(gameObject, ESwitchableObjectId.E_PANEL); _postboxDoor = SelectableObject.GetAsChildByPath(gameObject, ESwitchableObjectId.POSTBOX_LEFT_DOOR); _returnableObjects = transform.GetComponentsInChildren <IInitStateReturnable>(true).ToList(); PlayerPlaceholder = transform.Find(_playerPlaceholderName).gameObject; Elevator = transform.Find("elevator").GetComponent <Elevator>(); Transform lights = transform.Find("lights"); _frontLight = lights.GetChild(0).GetComponent <Light>(); _backLight = lights.GetChild(1).GetComponent <Light>(); _frontLightInitIntensity = _frontLight.intensity; _backLightInitIntensity = _backLight.intensity; transform.GetComponentsInChildren <InventoryObject>(true) .ToList() .ForEach(io => _inventoryObjects.Add(io.objectId, io)); _ePanelDoor.OpenCondition = () => _markStates[EFloorMarkId.RABBIT_SYMBOL]; _postboxDoor.OpenCondition = () => _markStates[EFloorMarkId.DRAGONFLY]; if (AdGenerator == null) { throw new Exception("AdGenerator is not provided to the floor"); } if (ResourcesController == null) { throw new Exception("ResourcesController is not provided to the floor"); } if (doorController == null) { throw new Exception("doorController is not provided to the floor"); } SetGcAdsRandomTextures(); }
private void OnValidate() { if (target) { if (oldtarget) { oldtarget.SwitchedBy.Remove(transform); } target.SwitchedBy.Add(transform); oldtarget = target; } else { if (oldtarget) { oldtarget.SwitchedBy.Remove(transform); } oldtarget = null; } }
public void Init() { colourController = ColourController.instance; colourOneSwitchables = new List <SwitchableObject>(); colourTwoSwitchables = new List <SwitchableObject>(); foreach (GameObject switchable in GameObject.FindGameObjectsWithTag("Switchable")) { SwitchableObject s = switchable.GetComponent <SwitchableObject>(); s.Init(); if (s.colour == SwitchableColour.colourOne) { colourOneSwitchables.Add(s); } else { colourTwoSwitchables.Add(s); } } Switch(); }