Пример #1
0
    // Update is called once per second
    void UpdateEverySecond()
    {
        if (currentStatus.Equals(status.QUEUE))
        {
            if (lastVisitedAttraction.npcsWaiting.Count <= lastVisitedAttraction.npcAmount)
            {
                UpdateHappiness(game.penaltyInQueue);
            }
            else if (lastVisitedAttraction.npcsWaiting.Count > lastVisitedAttraction.npcAmount)
            {
                UpdateHappiness(Mathf.RoundToInt(game.penaltyInQueue * game.overfilledQueuePenaltyMultiplier));
            }
        }

        if (currentStatus.Equals(status.ATTRACTION))
        {
            UpdateHappiness(game.rewardInAttraction);
        }

        if (walkRandom && currentStatus == status.IDLE && remainingIdleTime > 0)
        {
            --remainingIdleTime;
        }

        UpdateShirtColor();

#if UNITY_EDITOR
        gameObject.name = "NPC [" + currentStatus.ToString() + "]";
#endif
    }
Пример #2
0
 public string CheckLanding(Rectangle rocketBounds, Rectangle platformBounds)
 {
     //is there an intersection
     if (rocketBounds.IntersectsWith(platformBounds))
     {
         //check horizontal velocity
         if (Math.Abs(xVel) <= maxX)
         {
             //check vertical velocity
             if (Math.Abs(yVel) <= maxY)
             {
                 if (Math.Abs(rocketBounds.Bottom - platformBounds.Top) < 20)
                 {
                     MessageBox.Show("Congratulation!", "Landed", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     hasLanded = status.LANDED;
                     return(hasLanded.ToString());
                 }
                 else
                 {
                     MessageBox.Show("Ouch", "Crashed", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                     hasLanded = status.CRASHED;
                     return(hasLanded.ToString());
                 }
             }
             else
             {
                 //yVel is too large
                 MessageBox.Show("Maximum vertical velocity exceeded!\n\nVertical Velocity: " + Math.Round(Math.Abs(yVel)) + " pixel/s      Max: " + maxY + " pixel/s",
                                 "Crashed", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 hasLanded = status.CRASHED;
                 return(hasLanded.ToString());
             }
         }
         else
         {
             if (Math.Abs(yVel) >= maxY)
             {
                 //xVel and yVel are too large
                 MessageBox.Show("Maximum vertical and horizontal velocity exceeded!\n\nVertical Velocity:     " + Math.Round(Math.Abs(yVel)) + " pixel/s      Max: " + maxY + " pixel/s\nHorizontal Velocity: " + Math.Round(Math.Abs(xVel)) + " pixel/s      Max: " + maxX + " pixel/s",
                                 "Crashed", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 hasLanded = status.CRASHED;
                 return(hasLanded.ToString());
             }
             else
             {
                 //xVel is too large
                 MessageBox.Show("Maximum horizontal velocity exceeded!\n\nHorizontal Velocity: " + Math.Round(Math.Abs(xVel)) + " pixel/s      Max: " + maxX + " pixel/s",
                                 "Crashed", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 hasLanded = status.CRASHED;
                 return(hasLanded.ToString());
             }
         }
     }
     hasLanded = status.MOVING;
     return(hasLanded.ToString());
 }
Пример #3
0
        private void sendSubscribeRequest(string uri, string email)
        {
            if (checkEmail(email))
            {
                WebRequest request = createWebRequest(uri, "POST");

                string responseFromServer = "";
                status statusCode         = status.SUCCESS;
                string message            = umbraco.library.GetDictionaryItem("ThankYou");//TODO: localize

                try
                {
                    // Get the response.
                    WebResponse response = request.GetResponse();

                    // Get the stream containing content returned by the server.
                    Stream dataStream = response.GetResponseStream();

                    // Open the stream using a StreamReader for easy access.
                    StreamReader reader = new StreamReader(dataStream);

                    // Read the content.
                    responseFromServer = reader.ReadToEnd();

                    reader.Close();
                    dataStream.Close();
                    response.Close();
                }
                catch (WebException we)
                {
                    statusCode = status.CM_ERROR;
                    message    = "There was an error with your registration, please try back later.";//TODO: Localize

                    if (we.Status == WebExceptionStatus.ProtocolError)
                    {
                        cmResponseCode = (int)((HttpWebResponse)we.Response).StatusCode;
                    }
                    else
                    {
                        cmResponseCode = 500;
                    }
                }

                returnValue.Add("status", statusCode.ToString());
                returnValue.Add("cmResponse", responseFromServer);
                returnValue.Add("message", message);
                returnValue.Add("code", cmResponseCode.ToString());
                //returnValue.Add("jsonSent", postData);
            }
            else
            {
                returnValue.Add("status", status.EMAIL_INVALID.ToString());
                returnValue.Add("message", umbraco.library.GetDictionaryItem("RequiredEmail"));//TODO: Localize
            }
        }
 void carregaDataGrid(status Status)
 {
     dgOrcamento.DataSource = contexto.venda.Where(v => v.ven_status.Contains(Status.ToString())).Select(x => new
     {
         x.itensvenda.Where(i => i.ven_cod == x.ven_cod).FirstOrDefault().ClienteProduto.cliente.cli_nome,
         x.ven_cod,
         x.ven_status,
         x.ven_total,
         x.ven_data_entrada,
         x.ven_data_saida
     }).ToList();
 }
Пример #5
0
        public animation(Folders f, status s, ContentManager cm)
        {
            string name = "fighters/" + f.ToString() + "/" + s.ToString();

            texture    = cm.Load <Texture2D>(name);
            speed      = 0.1f;
            head       = new List <Circle>();
            body       = new List <Circle>();
            legs       = new List <Circle>();
            hitbox     = new List <Rectangle>();
            knockback  = new List <Vector2>();
            isloopable = false;
            Processing1(cm, name);
            maketranspernt();
        }
Пример #6
0
 public string CheckLanding(Rectangle rocketBounds, Rectangle platformBounds)
 {
     //is there an intersection
     if (rocketBounds.IntersectsWith(platformBounds))
     {
         //check horizontal velocity
         if (Math.Abs(xVel) <= maxX)
         {
             //check vertical velocity
             if (Math.Abs(yVel) <= maxY)
             {
                 if (Math.Abs(rocketBounds.Bottom - platformBounds.Top) < 20)
                 {
                     MessageBox.Show("Congratulation!", "Landed", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     hasLanded = status.LANDED;
                     return hasLanded.ToString();
                 }
                 else
                 {
                     MessageBox.Show("Ouch", "Crashed", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                     hasLanded = status.CRASHED;
                     return hasLanded.ToString();
                 }
             }
             else
             {
                 //yVel is too large
                 MessageBox.Show("Maximum vertical velocity exceeded!\n\nVertical Velocity: " + Math.Round(Math.Abs(yVel)) + " pixel/s      Max: " + maxY + " pixel/s", 
                     "Crashed", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 hasLanded = status.CRASHED;
                 return hasLanded.ToString();
             }
         }
         else
         {
             if (Math.Abs(yVel) >= maxY)
             {
                 //xVel and yVel are too large
                 MessageBox.Show("Maximum vertical and horizontal velocity exceeded!\n\nVertical Velocity:     " + Math.Round(Math.Abs(yVel)) + " pixel/s      Max: " + maxY + " pixel/s\nHorizontal Velocity: " + Math.Round(Math.Abs(xVel)) + " pixel/s      Max: " + maxX + " pixel/s",
                     "Crashed", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 hasLanded = status.CRASHED;
                 return hasLanded.ToString();
             }
             else
             {
                 //xVel is too large
                 MessageBox.Show("Maximum horizontal velocity exceeded!\n\nHorizontal Velocity: " + Math.Round(Math.Abs(xVel)) + " pixel/s      Max: " + maxX + " pixel/s",
                     "Crashed", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 hasLanded = status.CRASHED;
                 return hasLanded.ToString();
             }
         }
     }
     hasLanded = status.MOVING;
     return hasLanded.ToString(); 
 }
        private static Status ToDomainObject(status status)
        {
            var tilstand = Enum.Parse(typeof(Status), status.ToString());

            return((Status)tilstand);
        }
Пример #8
0
 public string GetCurrentStatus()
 {
     return(currentStatus.ToString());
 }