private void Awake() { mRigid = GetComponent <Rigidbody>(); mEntity = GetComponent <AI_Controller>(); mAnim = UT_FindComponent.FindComponent <AN_Enemies>(gameObject); mModelFollower = UT_FindComponent.FindComponent <ObjectFollower>(gameObject); }
/// <summary> /// Configures the offset object follower based on the facade settings. /// </summary> public virtual void ConfigureOffsetObjectFollower() { if (Facade.Offset != null) { offsetObjectFollower = Facade.Offset.GetComponent <ObjectFollower>(); } }
/// <summary> /// Configures the source object follower based on the facade settings. /// </summary> public virtual void ConfigureSourceObjectFollower() { if (Facade.Source != null) { sourceObjectFollower = Facade.Source.GetComponent <ObjectFollower>(); } }
public void StartWheelEffect() { var wheelTrail = Instantiate(wheelTrailPrefab, transform.position, transform.rotation); currentWheelTrail = wheelTrail.GetComponent <ObjectFollower>(); currentWheelTrail.SetObjectToFollow(gameObject.transform); }
protected virtual void OnEnable() { if (source != null) { sourceObjectFollower = source.GetComponent <ObjectFollower>(); } if (offset != null) { offsetObjectFollower = offset.GetComponent <ObjectFollower>(); } }
public void SetUp() { containingObject = new GameObject(); subject = containingObject.AddComponent <ObjectFollower>(); }
protected virtual void OnDisable() { sourceObjectFollower = null; offsetObjectFollower = null; }
/// <summary> /// This method creates a info text and ledger line on the x axis at the particular x position. At the end both object are added to the lists 'xLists' and 'xTexts'. /// </summary> private void AddXInfo(float xPos, object xObj = null) { // convert the x object to a readable string string infoText = ""; if (xObj != null) { infoText = GetNameFromXObject(xObj); } RectTransform scrollRt = scrollContent.GetComponent <RectTransform>(); // create a new ledger line object GameObject ledgerObj = Object.Instantiate(UIManager.GetInstance().imagePrefab, xLedgerPanel.transform); // rename the object ledgerObj.name = "LedgerLine" + xLedgerPanel.transform.childCount; Vector2 pos = new Vector2(xPos, -scrollRt.sizeDelta.y / 2 + xLedgerLineHeight / 2 + thickness / 2); // set its position and size RectTransform rt = ledgerObj.GetComponent <RectTransform>(); rt.localPosition = pos; rt.sizeDelta = new Vector2(thickness, xLedgerLineHeight); // set its color Image img = ledgerObj.GetComponent <Image>(); img.color = ledgerLineColor; // add the ledger line to the list xLines.Add(rt); // create text GameObject textObj = Instantiate(UIManager.GetInstance().textPrefab, xLedgerPanel.transform); // rename the object textObj.name = "Info" + xLedgerPanel.transform.childCount; // set the position RectTransform textRt = textObj.GetComponent <RectTransform>(); textRt.localPosition = new Vector2(pos.x, -scrollRt.sizeDelta.y / 2 - fontSize / 10); // get and set the text, font size and color Text text = textObj.GetComponent <Text>(); text.text = infoText; text.fontSize = fontSize; text.color = axisColor; // add the text to the list xTexts.Add(text); // reparent it to the x info object textObj.transform.SetParent(xAxisPanel.transform); // make the x info text follow the x ledger line which is still a child of the content ObjectFollower objFollower = textObj.AddComponent <ObjectFollower>(); objFollower.Follow(ledgerObj); }
protected virtual void OnDisable() { StopCheckDivergenceAtEndOfFrameRoutine(); sourceObjectFollower = null; offsetObjectFollower = null; }