Beispiel #1
0
    /// <summary>
    /// Unity Function. Called once upon creation of the object.
    /// </summary>
    void Awake()
    {
//		if (!this.isArbitrary) {
//			FractionData fraction = PedagogicalComponent_v2.Instance.RequestFraction ();
//			this.numerator = fraction.numerator;
//			this.denominator = fraction.denominator;
//		}
        if (this.CantCarry())
        {
            this.isPurelyKinematic = true;
        }
//		this.clone = GetComponentInChildren<BrokenClone> ();
        this.ResetBreak();
        this.fractionLabel = GetComponentInChildren <BrokenFractionLabel> ();

        this.rectTransform = GetComponent <RectTransform> ();
        this.rigidBody2D   = GetComponent <Rigidbody2D> ();
        this.boxCollider   = GetComponent <BoxCollider2D> ();

//		this.brokenPiece = GetComponentInChildren<BrokenPiece> ();
        this.spriteRenderer = GetComponent <SpriteRenderer> ();
        this.lineRenderer   = GetComponent <LineRenderer> ();

        //EventBroadcaster.Instance.AddObserver(EventNames.SPAWN_BLOCKS_PROCESS_ON, BlockProcessOn);
        EventBroadcaster.Instance.AddObserver(EventNames.SPAWN_BLOCKS_PROCESS_OFF, BlockProcessOff);
    }
Beispiel #2
0
    void Awake()
    {
        this.clone         = GetComponentInChildren <BrokenClone> ();
        this.fractionLabel = GetComponentInChildren <BrokenFractionLabel> ();

        this.rectTransform = GetComponent <RectTransform> ();
        this.rigidBody2D   = GetComponent <Rigidbody2D> ();
        this.boxCollider   = GetComponent <BoxCollider2D> ();

        this.brokenPiece    = GetComponentInChildren <BrokenPiece> ();
        this.spriteRenderer = GetComponent <SpriteRenderer> ();
        this.lineRenderer   = GetComponent <LineRenderer> ();

        this.widthWhole  = this.rectTransform.rect.width;
        this.widthSingle = this.widthWhole / this.GetDenominator();
        this.widthPiece  = this.widthSingle * this.GetNumerator();
        this.height      = this.rectTransform.rect.height;

        this.fractionLabel.SetFraction((int)this.GetNumerator(), (int)this.GetDenominator());
    }