コード例 #1
0
    void nonResilientCollision(CommunicationItem item) // функция считающая значение скорочти объекта при неупругом столкновении
    {
        float newSpeed = (item.getMass() * item.getSpeed() + toSend.getMass() * toSend.getSpeed()) /
                         (toSend.getMass() + item.getMass()); // соответственно рассчет скорочти по формуле

        ball.velocity = new Vector3(newSpeed, 0, 0);          // присваивание объекту значение новой скорочти
        setupInfoUI(newSpeed);
    }
コード例 #2
0
 public void getParamsOfCollision(CommunicationItem item) // системная функция выбирающая тип рассчета скорочти в зависимости от типа столковения отправленного столкнувшимся объектом
 {
     if (item.getType() == "r")
     {
         Debug.Log("It is resilent");
         resilientCollision(item);
         return;
     }
     nonResilientCollision(item);
 }
コード例 #3
0
    void resilientCollision(CommunicationItem item) // функция считающая значение скорочти при упругом столкновении
    {
        Debug.Log("- - - - - -  - - - -  - - -");
        Debug.Log(item.getMass());
        Debug.Log(item.getSpeed());
        Debug.Log(toSend.getMass());
        Debug.Log(toSend.getSpeed());
        Debug.Log("- - - - - -  - - - -  - - -");
        float newSpeed = (2 * item.getMass() * item.getSpeed() + (toSend.getMass() - item.getMass()) * toSend.getSpeed()) / (item.getMass() + toSend.getMass()); // рассчет скорости по формуле

        Debug.Log(newSpeed);
        ball.velocity = new Vector3(newSpeed, 0, 0); // присваивание объекту значение новой скорочти
        setupInfoUI(newSpeed);
    }
コード例 #4
0
 /// <summary>
 /// Handles the RowDataBound event of the gCommunication control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="GridViewRowEventArgs"/> instance containing the event data.</param>
 /// <exception cref="System.NotImplementedException"></exception>
 void gCommunication_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (!UserCanEdit && e.Row.RowType == DataControlRowType.DataRow)
     {
         CommunicationItem communication = e.Row.DataItem as CommunicationItem;
         if (
             !CurrentPersonAliasId.HasValue ||
             communication == null ||
             !communication.CreatedByPersonAliasId.HasValue ||
             communication.CreatedByPersonAliasId.Value != CurrentPersonAliasId.Value)
         {
             var lb = e.Row.Cells[5].ControlsOfTypeRecursive <LinkButton>().FirstOrDefault();
             if (lb != null)
             {
                 lb.Visible = false;
             }
         }
     }
 }
コード例 #5
0
 public void Visit(CommunicationItem item) => ShowString(item);