public void setCollider(types type, frames frame)
 {
     if (frame != frames.clear)
     {
         switch ((int)type)
         {
         case (int)types.idle:
             localCollider.SetPath (0, idle [(int)frame].GetPath (0));
             break;
         case (int)types.run:
             localCollider.SetPath (0, run [(int)frame].GetPath (0));
             break;
         case (int)types.jump:
             localCollider.SetPath (0, jump [(int)frame].GetPath (0));
             break;
         case (int)types.fall:
             localCollider.SetPath (0, fall [(int)frame].GetPath (0));
             break;
         case (int)types.land:
             localCollider.SetPath (0, land [(int)frame].GetPath (0));
             break;
         case (int)types.neutral_light:
             localCollider.SetPath (0, neutralLight [(int)frame].GetPath (0));
             break;
         default:
             localCollider.SetPath (0, neutralHeavy [(int)frame].GetPath (0));
             break;
         }
         return;
     }
     localCollider.pathCount = 0;
 }
Beispiel #2
0
    public void setCollider(types type, frames frame)
    {
        if (frame != frames.clear)
        {
            switch ((int)type)
            {
            case (int)types.idle:
                localCollider.SetPath(0, idle[(int)frame].GetPath(0));
                break;

            case (int)types.run:
                localCollider.SetPath(0, run[(int)frame].GetPath(0));
                break;

            case (int)types.neutral_light:
                localCollider.SetPath(0, neutralLight[(int)frame].GetPath(0));
                break;

            default:
                localCollider.SetPath(0, neutralHeavy[(int)frame].GetPath(0));
                break;
            }
            return;
        }
        localCollider.pathCount = 0;
    }
        public IHttpActionResult GetWeatherUpdates(string zipcode, string tempscale)
        {
            try
            {
                bool isTempScaleCelsius = true;
                if (!string.IsNullOrEmpty(tempscale) && tempscale == "Fahrenheit")
                {
                    isTempScaleCelsius = false;
                }

                Weather data = GetWeatherData(zipcode);


                if (string.IsNullOrEmpty(zipcode))
                {
                    zipcode = "10001";
                }
                frames currentTemp;
                if (isTempScaleCelsius)
                {
                    currentTemp = new frames()
                    {
                        chartData = null, index = null
                    };
                    currentTemp.text = " " + Math.Round(data.CrntTemp.Temperature - 273.15, 1) + " Current Temp";
                    currentTemp.icon = "i7066";
                }
                else
                {
                    currentTemp = new frames()
                    {
                        chartData = null, index = null
                    };
                    currentTemp.text = " " + Math.Round(1.8 * (data.CrntTemp.Temperature - 273), 1) + 32 + " Current Temp";
                    currentTemp.icon = "12465";
                }
                string details = System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(data.CrntTemp.Details.ToLower());

                int[] _chartdata = data.Readings.Select(x => Convert.ToInt32(x.Temperature)).ToArray();

                lametric lametric = new Models.lametric();
                lametric.frames    = new frames[4];
                lametric.frames[0] = new frames()
                {
                    icon = "i2272", text = "Weather in " + data.City
                };
                lametric.frames[1] = currentTemp;
                lametric.frames[2] = new frames()
                {
                    icon = "i2272", text = " " + details, chartData = null, index = null
                };
                lametric.frames[3] = new frames()
                {
                    index = 3, chartData = _chartdata
                };
                return(Json(lametric));
            }
            catch (Exception ex)
            {
                return(null);
            }
        }