public void configDoorArea(BlockDireciton direction) { Vector2 centerPosition = transform.position; switch (direction) { case BlockDireciton.Top: topDoor.transform.position = new Vector2(centerPosition.x - 1, centerPosition.y); bottomDoor.transform.position = new Vector2(centerPosition.x + 1, centerPosition.y); hitbox.transform.rotation = Quaternion.Euler(0, 0, 90); obstrucetBullet.transform.rotation = Quaternion.Euler(0, 0, 90); daDircetion = BlockDireciton.Top; break; case BlockDireciton.Right: daDircetion = BlockDireciton.Right; break; case BlockDireciton.Bottom: topDoor.transform.position = new Vector2(centerPosition.x - 1, centerPosition.y); bottomDoor.transform.position = new Vector2(centerPosition.x + 1, centerPosition.y); hitbox.transform.rotation = Quaternion.Euler(0, 0, 90); obstrucetBullet.transform.rotation = Quaternion.Euler(0, 0, 270); daDircetion = BlockDireciton.Bottom; break; case BlockDireciton.Left: obstrucetBullet.transform.rotation = Quaternion.Euler(0, 0, 180); daDircetion = BlockDireciton.Left; break; } }
public bool receiveChannelControl(BlockDireciton direction, bool isClose) { bool result = false; if (direction == channelDirection) { gameObject.SetActive(isClose); result = true; } return(result); }
public void configChannel() { if (gameObject.name.Contains("Top")) { channelDirection = BlockDireciton.Top; } if (gameObject.name.Contains("Right")) { channelDirection = BlockDireciton.Right; } if (gameObject.name.Contains("Bottom")) { channelDirection = BlockDireciton.Bottom; } if (gameObject.name.Contains("Left")) { channelDirection = BlockDireciton.Left; } }