private void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("Note")) { GetActiveMusician(); for (int i = 0; i < musicians.Length; i++) { if (musicians[i] != null) { musicianStage = musicians[i].transform.parent.transform.parent; musicianParticleTrail = musicianStage.GetChild(0).GetChild(0).GetComponentInParent <ParticleTrail>().gameObject; musicianCursor = musicianStage.GetChild(0).GetComponentInParent <BGCcCursor>(); //InitializeValues(); Debug.Log("StageName: " + musicianStage.name); for (int z = 0; z < musicianParticleTrail.transform.childCount; z++) { musicianParticleTrail.transform.GetChild(z).GetComponent <ParticleSystem>().Stop(); //glitter.GetComponent<ParticleSystem>().Stop(); } musicianCursor.DistanceRatio = 0; musicianCursor.enabled = false; } } } }
// Use this for initialization void Start() { BGCcCursorChangeLinear linear = trackLine.GetComponent <BGCcCursorChangeLinear>(); BGCcCursor cursor = trackLine.GetComponent <BGCcCursor>(); linear.Speed = speed; }
void Start() { this.cam = GameObject.FindGameObjectWithTag("MainCamera"); this.Gamemaster = GameObject.FindGameObjectWithTag("GameController"); this.gameMasterAttributes = this.Gamemaster.GetComponent<GameMaster>(); this.waveSpawner = this.Gamemaster.GetComponent<Wavespawner>(); this.bubble = transform.gameObject; this.bubbles = this.gameMasterAttributes.bubbles; this.curve = this.gameMasterAttributes.curve; this.mathe = this.curve.GetComponent<BGCcMath>(); this.cursor = this.mathe.gameObject.AddComponent<BGCcCursor>(); this.rigidBodyAttr = transform.GetComponent<Rigidbody>(); this.rotationSpeed = 150; this.currentWaypoint = this.cursor.CalculateSectionIndex(); this.movedBubbleRow = new Transform[this.bubbles.childCount]; if (!this.isShooted) { this.checkBubbleState(); if (!this.isFirstBubble) { this.bubble.GetComponent<MoveOnSpline>().distanceCalc = this.bubble.GetComponent<Bubble>().beforeBubble.GetComponent<MoveOnSpline>().distanceCalc - this.gameMasterAttributes.bubbleSizeAverage; } } }
private void Awake() { m_BGCurve = GetComponentInChildren <BGCurve>(true); m_BGCursor = GetComponentInChildren <BGCcCursor>(true); GetComponentInChildren <RoutePresentation>(true).m_Route = this; m_BGCurve.gameObject.SetActive(false); }
public EffectMoveAndRotateAlongCurve(BGCcCursor cursor, GameObject target, float period, int rotateCount, float rotationDistance, float initialRotationRadians = 0) : base(period, period) { this.target = target; this.cursor = cursor; this.rotateCount = rotateCount; this.rotationDistance = rotationDistance; this.initialRotationRadians = initialRotationRadians; }
void CreateSplineComponents(GameObject splineObject) { spline = splineObject.AddComponent <BGCurve>(); spline.PointsMode = BGCurve.PointsModeEnum.GameObjectsTransform; math = splineObject.AddComponent <BGCcMath>(); math.Fields = BGCurveBaseMath.Fields.PositionAndTangent; cursor = splineObject.AddComponent <BGCcCursor>(); var field = spline.AddField(Keys.NORMAL_FIELD, BGCurvePointField.TypeEnum.Vector3); }
//instantiate a game object and proper components to have it move along the curve public void AddTranslateObjectToCurve(GameObject newObj) { //spawn obj to move GameObject obj = Instantiate(newObj); MoveAlongCurve newMAC = obj.GetComponent <MoveAlongCurve>(); if (newMAC == null) { Debug.LogWarning("Object " + newObj + " does not have a MoveAlongCurve compnenet attached, but is trying to" + " be is needed to work with SpawnObjOnCurve script"); Destroy(newMAC); return; } obj.name = MACs.Count.ToString(); //create new cursor for obj to translate along BGCcCursor newCursor = CurveObj.AddComponent <BGCcCursor>(); //add new CursorObjectTranslate to set translated object BGCcCursorObjectTranslate newTranslate = CurveObj.AddComponent <BGCcCursorObjectTranslate>(); //add cursor objec trotate to set rotation BGCcCursorObjectRotate newRotate = CurveObj.AddComponent <BGCcCursorObjectRotate>(); //set newTranslate's and newRotate's cursor to the new cursor newTranslate.Cursor = newCursor; newRotate.Cursor = newCursor; //set obj to be moved by newTranslate and newRotate newTranslate.ObjectToManipulate = obj.transform; newRotate.ObjectToManipulate = obj.transform; //set newMACs cursor to new cursor newMAC.cursor = newCursor; newMAC.UpdatePos(0); MACs.Add(newMAC); curveSpawner.UpdateCurveMoversDropDown(); print("added new mover to curve"); }
// Use this for initialization void Start() { curve = GetComponent <BGCurve>(); math = GetComponent <BGCcMath>(); cursor = GetComponent <BGCcCursor>(); cursorLinear = GetComponent <BGCcCursorChangeLinear>(); //startingspeed = objectPrefab.GetComponent<XXXXXX>().speed; currentSpeed = startingSpeed; speedBeforeStopped = startingSpeed; cursorLinear.Speed = startingSpeed; //distance = math.Math[pointListIndex].DistanceFromStartToOrigin; distance = math.Math.GetDistance(pointIndex); //Instantiate the object objectToMove = Instantiate(objectPrefab, curve[0].PositionWorld, Quaternion.Euler(0, 0, 0)); //Sets the object so that the path moves the object GetComponent <BGCcCursorObjectTranslate>().ObjectToManipulate = objectToMove.transform; //Sets the overflow to the right one in BGCCursorChangeLinear switch (overflowType) { case OverflowType.Stop: cursorLinear.OverflowControl = BGCcCursorChangeLinear.OverflowControlEnum.Stop; break; case OverflowType.Cycle: cursorLinear.OverflowControl = BGCcCursorChangeLinear.OverflowControlEnum.Cycle; break; case OverflowType.PingPong: cursorLinear.OverflowControl = BGCcCursorChangeLinear.OverflowControlEnum.PingPong; break; } }
private void InitializeValues() { musicianStage = GetActiveMusician().transform.parent.transform.parent; musicianParticleTrail = musicianStage.GetChild(0).GetChild(0).GetComponentInParent <ParticleTrail>().gameObject; musicianCursor = musicianStage.GetChild(0).GetComponentInParent <BGCcCursor>(); }