private void Update() { if (Input.GetKeyDown(KeyCode.E)) { Collider2D[] collider2DArray = Physics2D.OverlapCircleAll(playerTransform.position, 20f); Debug.Log(collider2DArray.Length); foreach (Collider2D collider2D in collider2DArray) { DoorAnims doorAnims = collider2D.GetComponent <DoorAnims>(); if (doorAnims != null) { doorAnims.OpenDoor(); //isOpen = true; } } /* * isOpen = !isOpen; * if (isOpen) { * door.OpenDoor(); * } else { * door.CloseDoor(); * } */ } }
private void Start() { DoorAnims doorAnims = GetComponent <DoorAnims>(); if (startOpen) { doorAnims.OpenDoor(); } else { doorAnims.CloseDoor(); } doorAnims.SetColor(doorColor); }
private void Awake() { doorAnims = GetComponent <DoorAnims>(); }