private void RefreshPreviewObjectValidity() { if (PreviewObject_ == null) { return; } Vector3 halfExtents = this.transform.localScale / 2.0f; halfExtents = halfExtents.SetX(halfExtents.x - 0.1f); halfExtents = halfExtents.SetZ(halfExtents.z - 0.1f); bool hit = Physics.BoxCast(this.transform.position + Vector3.up, halfExtents: halfExtents, direction: -Vector3.up, orientation: Quaternion.identity, maxDistance: Mathf.Infinity, layerMask: InGameConstants.PlatformsLayerMask); foreach (var renderer in PreviewObject_.GetComponentsInChildren <Renderer>()) { renderer.material.color = hit ? Color.red : Color.green; } }
protected override void Initialize() { playerIndex_ = PreviewObject_.GetComponent <LevelEditorPlayerSpawnPoint>().PlayerIndex; }