void ConfigChannleWallAndDoor() { //通知方向墙壁 根据链接设置判定开关哪些通道的墙壁 ChannelWallController[] ccs = GetComponentsInChildren <ChannelWallController>(); foreach (ChannelWallController cc in ccs) { foreach (BlockDireciton direction in directions) { if (cc.receiveChannelControl(direction, false)) { Vector2 posation = Vector2.zero; //生成门 switch (direction) { case BlockDireciton.Top: posation = new Vector2(blockCenterPosation.x, blockCenterPosation.y + blockDirectionOffset); break; case BlockDireciton.Right: posation = new Vector2(blockCenterPosation.x + blockDirectionOffset, blockCenterPosation.y); break; case BlockDireciton.Bottom: posation = new Vector2(blockCenterPosation.x, blockCenterPosation.y - blockDirectionOffset); break; case BlockDireciton.Left: posation = new Vector2(blockCenterPosation.x - blockDirectionOffset, blockCenterPosation.y); break; } DoorAreaController dac = ((GameObject)Instantiate(Resources.Load("Wall/DoorArea/DoorArea"), posation, Quaternion.identity)).GetComponent <DoorAreaController>(); dac.configDoorArea(direction); dac.transform.parent = transform; break; } } } ; }
public void ConfigDefault() { dac = GetComponentInParent <DoorAreaController>(); }