예제 #1
0
        public ActionResult createFence(fenceModel f)
        {
            tempFence tf = new tempFence();

            tf.Latitude      = f.latitude.ToString();
            tf.Longitude     = f.longitude.ToString();
            tf.Notification_ = f.notification;
            tf.TimeStamp     = DateTime.Now.AddHours(f.hr).ToString("MM/dd/yyyy HH:mm:ss");

            tf.Radius = f.radius.ToString();
            IFirebaseConfig mes = new FirebaseConfig
            {
                AuthSecret = "CwnE0VGXMqxNxcY5YSWVNcL7IAM3hfqRuSiNjWm5",
                BasePath   = "https://xdadeveloperes.firebaseio.com/"
            };

            IFirebaseClient mfc;

            mfc = new FireSharp.FirebaseClient(mes);
            var          data = tf;
            PushResponse r    = mfc.Push("Fences_" + "/", data);

            updateFencingHours(Convert.ToInt32(f.vendorId), f.hr);

            var   context = new promoLacDbEntities();
            fence fence_  = new fence();

            fence_.latitude     = f.latitude;
            fence_.longitude    = f.longitude;
            fence_.startTime    = DateTime.Now;
            fence_.endTime      = DateTime.Now.AddHours(f.hr);
            fence_.notification = f.notification;
            fence_.radius       = f.radius;
            fence_.vendorId     = f.vendorId;
            fence_.area         = f.AreaName;

            context.fences.Add(fence_);
            context.SaveChanges();

            return(Json(new { success = true, message = "dddd" }, JsonRequestBehavior.AllowGet));
        }
예제 #2
0
    void OnTriggerEnter(Collider col)
    {
        Debug.Log("collided with " + col.transform.name);

        Bullet bullet = col.GetComponent <Bullet>();

        if (bullet)
        {
            health--;
            GameObject.Destroy(bullet.gameObject);
            if (health <= 0)
            {
                GameObject.Destroy(this.transform.gameObject);
            }
        }
        else
        {
            fence Fence = col.GetComponent <fence>();
            if (Fence)
            {
                GameObject.Destroy(this.transform.gameObject);
            }
        }
    }