void FindTarget() { target = Getter.ObjectWithTag(caller: this, tag: PersonsTags.Player.ToString(), errorOnNotFound: Errors.PlayerNotFound ).transform; Vector3 pos = this.transform.position; pos.x = target.position.x + offset.x + 3; pos.y = target.position.y + offset.y; this.transform.position = pos; }
void Awake() { PositionUtil positionUtil = new PositionUtil(); GameObject bottomLimitView = Getter.ObjectWithTag(caller: this, tag: ElementiesTags.BottomLimitView.ToString()); GameObject rightLimitView = Getter.ObjectWithTag(caller: this, tag: ElementiesTags.RightLimitView.ToString()); GameObject leftLimitView = Getter.ObjectWithTag(caller: this, tag: ElementiesTags.LeftLimitView.ToString()); BoxCollider2D boxCollider2D = (BoxCollider2D)Getter.Component(this, gameObject, typeof(BoxCollider2D)); Vector2 vector2 = boxCollider2D.size; vector2.x = positionUtil.GetHorizontalDistanceBetweenGameObjects(leftLimitView, rightLimitView) + incrementeInHorizontalSize; vector2.y = 1; boxCollider2D.size = vector2; Vector3 thisPosition = this.transform.position; thisPosition.x = positionUtil.GetHorizontalMiddlePointBetweenGameObjects(leftLimitView, rightLimitView); thisPosition.y = bottomLimitView.transform.position.y - distanceBellowFromBottomLimitView; this.transform.position = thisPosition; }
void SetBottomLimiteToStillAlive() { bottomLimit = Getter.ObjectWithTag(this, ElementiesTags.BottomLimitView.ToString()).transform.position.y - 7; }