private void SetupDynamicWalls() { if (_upperWall == null) { throw new MissingComponentException("Upper Wall has not been assigned"); } if (_lowerWall == null) { throw new MissingComponentException("Lower Wall has not been assigned"); } _upperDynamicWall = _upperWall.GetComponent <DynamicWall>(); _lowerDynamicWall = _lowerWall.GetComponent <DynamicWall>(); if (_upperDynamicWall == null || _lowerDynamicWall == null) { throw new MissingComponentException("Upper Wall and Lower Wall must both contain a DynamicWall script"); } _upperDynamicWall.IsUpperWall = true; _lowerDynamicWall.IsUpperWall = false; _upperDynamicWall.UpperLeft = _upperLeft; _lowerDynamicWall.UpperLeft = _upperLeft; _upperDynamicWall.LowerRight = _lowerRight; _lowerDynamicWall.LowerRight = _lowerRight; _upperDynamicWall.SegmentCount = _segmentCount; _lowerDynamicWall.SegmentCount = _segmentCount; _upperDynamicWall.Clip = _clip; _lowerDynamicWall.Clip = _clip; ResetGap(); Perlin.Instance.Reset(true); _upperDynamicWall.InitMesh(); _lowerDynamicWall.InitMesh(); }
private void ActivateWall() { if (totalOrbs == 0) { return; } Ray ray = new Ray(lookTransform.position, lookTransform.forward); RaycastHit hit; if (Physics.Raycast(ray, out hit, Mathf.Infinity)) { if (hit.collider.tag == "DynamicWall") { DynamicWall wall = hit.collider.GetComponent <DynamicWall>(); int orbsToDeposit = Mathf.Min(totalOrbs, wall.remainingCost); wall.DepositOrbs(orbsToDeposit, GetComponent <PlayerIdentity>().playerTeam); totalOrbs -= orbsToDeposit; } } }