示例#1
0
    void Start()
    {
        brotherScript = brotherObject.GetComponent <DoubleBox>();
        canBounce     = true;
        InitTransformable();
        isPunchable           = true;
        isBreakable           = false;
        interactuableBySmash  = false;
        timeToBecomePunchable = 0.5f;
        offset = GameLogic.instance.worldOffset;
        if (worldAssignation == world.DAWN)
        {
            //GetComponent<Rigidbody2D>().bodyType = RigidbodyType2D.Kinematic;
            //GetComponent<SpriteRenderer>().sprite = imagenDawn;
            GetComponent <Rigidbody2D>().bodyType = RigidbodyType2D.Kinematic;
            transform.position += new Vector3(0, GameLogic.instance.worldOffset);
        }
        else
        {
            //GetComponent<SpriteRenderer>().sprite = imagenDusk;
            // GetComponent<Rigidbody2D>().bodyType = RigidbodyType2D.Kinematic;
            GetComponent <Rigidbody2D>().bodyType = RigidbodyType2D.Dynamic;
        }
        float randomVal = Random.Range(1, 4);

        //Debug.Log(randomVal);
        GetComponentInChildren <MeshRenderer>().gameObject.transform.rotation *= Quaternion.AngleAxis(randomVal * 90, new Vector3(0, 0, 1));

        rb         = GetComponent <Rigidbody2D>();
        groundMask = LayerMask.GetMask("Ground");

        rb.mass = 5000;
    }
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.components = new System.ComponentModel.Container();
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CoordinateDialog));
     this._btnOk    = new System.Windows.Forms.Button();
     this._btnClose = new System.Windows.Forms.Button();
     this._ttHelp   = new System.Windows.Forms.ToolTip(this.components);
     this._dbxM     = new DotSpatial.Symbology.Forms.DoubleBox();
     this._dbxZ     = new DotSpatial.Symbology.Forms.DoubleBox();
     this._dbxY     = new DotSpatial.Symbology.Forms.DoubleBox();
     this._dbxX     = new DotSpatial.Symbology.Forms.DoubleBox();
     this.SuspendLayout();
     //
     // _btnOk
     //
     resources.ApplyResources(this._btnOk, "_btnOk");
     this._btnOk.DialogResult = System.Windows.Forms.DialogResult.OK;
     this._btnOk.Name         = "_btnOk";
     this._ttHelp.SetToolTip(this._btnOk, resources.GetString("_btnOk.ToolTip"));
     this._btnOk.UseVisualStyleBackColor = true;
     this._btnOk.Click += new System.EventHandler(this.OkButton_Click);
     //
     // _btnClose
     //
     resources.ApplyResources(this._btnClose, "_btnClose");
     this._btnClose.Name = "_btnClose";
     this._ttHelp.SetToolTip(this._btnClose, resources.GetString("_btnClose.ToolTip"));
     this._btnClose.UseVisualStyleBackColor = true;
     this._btnClose.Click += new System.EventHandler(this.CloseButton_Click);
     //
     // _dbxM
     //
     resources.ApplyResources(this._dbxM, "_dbxM");
     this._dbxM.BackColorInvalid = System.Drawing.Color.Salmon;
     this._dbxM.BackColorRegular = System.Drawing.Color.Empty;
     this._dbxM.InvalidHelp      = "The value entered could not be correctly parsed into a valid double precision flo" +
                                   "ating point value.";
     this._dbxM.IsValid       = true;
     this._dbxM.Name          = "_dbxM";
     this._dbxM.NumberFormat  = null;
     this._dbxM.RegularHelp   = "Enter a double precision floating point value.";
     this._dbxM.Value         = 0D;
     this._dbxM.ValidChanged += new System.EventHandler(this.Coordinate_ValidChanged);
     //
     // _dbxZ
     //
     resources.ApplyResources(this._dbxZ, "_dbxZ");
     this._dbxZ.BackColorInvalid = System.Drawing.Color.Salmon;
     this._dbxZ.BackColorRegular = System.Drawing.Color.Empty;
     this._dbxZ.InvalidHelp      = "The value entered could not be correctly parsed into a valid double precision flo" +
                                   "ating point value.";
     this._dbxZ.IsValid      = true;
     this._dbxZ.Name         = "_dbxZ";
     this._dbxZ.NumberFormat = null;
     this._dbxZ.RegularHelp  = "Enter a double precision floating point value.";
     this._dbxZ.Value        = 0D;
     //
     // _dbxY
     //
     resources.ApplyResources(this._dbxY, "_dbxY");
     this._dbxY.BackColorInvalid = System.Drawing.Color.Salmon;
     this._dbxY.BackColorRegular = System.Drawing.Color.Empty;
     this._dbxY.InvalidHelp      = "The value entered could not be correctly parsed into a valid double precision flo" +
                                   "ating point value.";
     this._dbxY.IsValid       = true;
     this._dbxY.Name          = "_dbxY";
     this._dbxY.NumberFormat  = null;
     this._dbxY.RegularHelp   = "Enter a double precision floating point value.";
     this._dbxY.Value         = 0D;
     this._dbxY.ValidChanged += new System.EventHandler(this.Coordinate_ValidChanged);
     //
     // _dbxX
     //
     resources.ApplyResources(this._dbxX, "_dbxX");
     this._dbxX.BackColorInvalid = System.Drawing.Color.Salmon;
     this._dbxX.BackColorRegular = System.Drawing.Color.Empty;
     this._dbxX.InvalidHelp      = "The value entered could not be correctly parsed into a valid double precision flo" +
                                   "ating point value.";
     this._dbxX.IsValid       = true;
     this._dbxX.Name          = "_dbxX";
     this._dbxX.NumberFormat  = null;
     this._dbxX.RegularHelp   = "Enter a double precision floating point value.";
     this._dbxX.Value         = 0D;
     this._dbxX.ValidChanged += new System.EventHandler(this.Coordinate_ValidChanged);
     //
     // CoordinateDialog
     //
     resources.ApplyResources(this, "$this");
     this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     this.Controls.Add(this._dbxM);
     this.Controls.Add(this._dbxZ);
     this.Controls.Add(this._dbxY);
     this.Controls.Add(this._dbxX);
     this.Controls.Add(this._btnClose);
     this.Controls.Add(this._btnOk);
     this.MaximizeBox = false;
     this.MinimizeBox = false;
     this.Name        = "CoordinateDialog";
     this.ShowIcon    = false;
     this.TopMost     = true;
     this.ResumeLayout(false);
 }