internal async Task <string> GetChannelId() { string result = string.Empty; try { var query = HttpUtility.ParseQueryString(string.Empty); var url = UrlHelper.BuildUrl(Url, "api/channel/id", query); var json = await Transporter.Get(_identity, url); if (!string.IsNullOrEmpty(json)) { var channelIdentification = json.TryDeserializeObject <ChannelIdentification>(); if (channelIdentification != null) { result = channelIdentification.Id; } } } catch (Exception e) { MsgLogger.Exception($"{GetType().Name} - GetChannelId", e); } return(result); }
public void ShowTransporter(Transporter transporter) { if (transporter != null) { lblTransporterAddress.Text = transporter.LegalEntityProfile.Address.Name + ", " + transporter.LegalEntityProfile.AddressNumber + " " + transporter.LegalEntityProfile.AddressComp; lblTransporterLocalization.Text = transporter.LegalEntityProfile.Address.City + " - " + transporter.LegalEntityProfile.Address.Neighborhood + ", " + transporter.LegalEntityProfile.Address.StateId; lblPostalCode.Text = "CEP: " + transporter.LegalEntityProfile.Address.PostalCode; lblTransporterPhone.Text = "Tel: " + transporter.LegalEntityProfile.Phone.Replace("(__)____-____", ""); lblCNPJ.Text = transporter.LegalEntityProfile.CNPJ; lnkTransporterName.Text = transporter.LegalEntityProfile.CompanyName; lnkTransporterName.OnClientClick = "top.$.lightbox('Administration/Transporter.aspx?TransporterId=" + transporter.TransporterId + "&lightbox[iframe]=true');return;"; pnlTransporter.Visible = true; } txtTransporter.Text = ""; pnlTransporterSearch.Style.Add(HtmlTextWriterStyle.Display, "none"); OnSelectedTransporter(this, new SelectedTransporterEventArgs() { Transporter = transporter }); }
public bool Update(Transporter t) { _context.Transporters.Update(t); var result = Save(); return(result); }
public async Task <ActionResult <Transporter> > CreateAsync(Transporter transporter) { _db.Transporters.Add(transporter); await _db.SaveChangesAsync(); return(Ok(transporter)); }
// Update is called once per frame void Update() { if (m_spawnno >= m_maxspawnno) { return; } cooldowntimer += Time.deltaTime; if (cooldowntimer > cooldownreset) { GameObject go = Instantiate(m_spawn, transform.position, Quaternion.identity); AI ai = go.GetComponent <AI>(); if (ai != null) { ai.NextWaypoint = m_waypoints[0]; ai.WaypointSystem = this; } else { Transporter t = go.GetComponent <Transporter>(); t.NextWaypoint = m_waypoints[0]; t.WaypointSystem = this; } m_spawnno++; cooldowntimer = 0; } }
protected void txtTransporter_TextChanged(object sender, EventArgs e) { OnSelectingTransporter(this, new SelectingTransporterEventArgs() { TransporterName = txtTransporter.Text }); ProfileManager profileManager; if (txtTransporter.Text.Contains('|')) { profileManager = new ProfileManager(this); transporterManager = new TransporterManager(this); string[] identifications = txtTransporter.Text.Split('|'); string identification = identifications[0].ToString().Trim(); LegalEntityProfile legalEntityProfile = profileManager.GetLegalEntityProfile(identification); if (legalEntityProfile != null) { transporter = transporterManager.GetTransporterByLegalEntityProfile(Page.Company.CompanyId, legalEntityProfile.LegalEntityProfileId); } ShowTransporter(transporter); } }
//whenever there is a request, create an event(bypass) protected override void ControlRequest(RequestList requestListIn) { Dictionary <Storage, BinList> eventsToCreate = new Dictionary <Storage, BinList>(); Transporter transporter = this.Manager.LayoutManager.Layout.Transporter; foreach (Request request in requestListIn) { Bin bin = new Bin(request.ComponentType + "-Bin", this.Manager.LayoutManager.Layout, request.ComponentType); this.Manager.LayoutManager.Layout.Bins.Add(bin); bin.Destination = request.Owner; transporter.Receive(this.Manager.Time, bin); if (eventsToCreate.Keys.Contains(request.Owner)) { eventsToCreate[request.Owner].Add(bin); } else { eventsToCreate.Add(request.Owner, new BinList()); eventsToCreate[request.Owner].Add(bin); } } foreach (Storage storage in eventsToCreate.Keys) { double time = this.Manager.Time; time += transporter.TravelTime.GenerateValue(); for (int i = 0; i < eventsToCreate[storage].Count; i++) { time += transporter.TransferTime.GenerateValue(); } this.Manager.EventCalendar.ScheduleEndLoadUnloadEvent(time, eventsToCreate[storage], transporter, (BinMagazine)storage); } requestListIn.Clear(); }
public async Task <ParameterValue> GetParameterValue(string channelId, int nodeId, ushort index, byte subIndex) { ParameterValue result = null; try { MsgLogger.WriteLine($"get parameter, index=0x{index:X4}, subindex=0x{subIndex:X4}, device node id={nodeId}"); var query = HttpUtility.ParseQueryString(string.Empty); query["callerId"] = channelId; query["nodeId"] = $"{nodeId}"; query["index"] = $"{index}"; query["subIndex"] = $"{subIndex}"; var url = UrlHelper.BuildUrl(Url, "api/parameter/value", query); var json = await Transporter.Get(_identity, url); var parameterValue = json.TryDeserializeObject <ParameterValue>(); if (parameterValue != null) { result = parameterValue; MsgLogger.WriteLine($"get parameter, index=0x{index:X4}, subindex=0x{subIndex:X4}, device node id={nodeId} - success"); } } catch (Exception e) { MsgLogger.Exception($"{GetType().Name} - GetParameterValue", e); } return(result); }
public ActionResult DeleteConfirmed(int id) { Transporter transporter = transportService.FindById(id); transportService.DeleteTransporter(transporter); return(RedirectToAction("Index")); }
internal async Task <UserIdentity> CreateAlias(string role) { UserIdentity result = null; try { var query = HttpUtility.ParseQueryString(string.Empty); query["role"] = role; var url = UrlHelper.BuildUrl(Url, "api/user/create-alias", query); var json = await Transporter.Get(_identity, url); if (!string.IsNullOrEmpty(json)) { result = json.TryDeserializeObject <UserIdentity>(); } } catch (Exception e) { MsgLogger.Exception($"{GetType().Name} - CreateAlias", e); } return(result); }
public bool Insert(Transporter t) { _context.Transporters.Add(t); var result = Save(); return(result); }
protected void Page_Load(object sender, EventArgs e) { manager = new TransporterManager(this); if (!IsPostBack) { // //retrieve the transporterId from modalPopup // if (Request["TransporterId"] != null) Context.Items["TransporterId"] = Request["TransporterId"]; if (Context.Items["TransporterId"] != null) Page.ViewState["TransporterId"] = Context.Items["TransporterId"]; if (Page.ViewState["TransporterId"] != null) { originalTransporter = manager.GetTransporter(Convert.ToInt32(Page.ViewState["TransporterId"])); if (originalTransporter != null) Profile_LegalEntity1.CompanyProfileEntity = originalTransporter.LegalEntityProfile; } else if (Page.ViewState["LegalEntityProfileId"] != null) { originalTransporter = manager.GetTransporterByProfile(Convert.ToInt32(Page.ViewState["LegalEntityProfileId"])); if (originalTransporter != null) { Page.ViewState["ProfileExists"] = "0"; Profile_LegalEntity1.CompanyProfileEntity = originalTransporter.LegalEntityProfile; } } } }
public JsonResult GetTransporterDetails() { try { List <Transporter> lst_Transporter = new List <Transporter>(); DataTable dtMast = objDbTrx.GetTransportDtl(); if (dtMast.Rows.Count > 0) { for (int iCnt = 0; iCnt < dtMast.Rows.Count; iCnt++) { Transporter tr = new Transporter(); tr.Transporter_name = Convert.ToString(dtMast.Rows[iCnt]["Transport_name"].ToString()); tr.TransporterID = Convert.ToInt32(dtMast.Rows[iCnt]["ID"].ToString()); lst_Transporter.Add(tr); } dtMast.Dispose(); } ViewBag.ObjTransporterList = new SelectList(lst_Transporter, "TransporterID", "Transporter_name"); } catch (Exception ex) { objDbTrx.SaveSystemErrorLog(ex, Request.UserHostAddress); } return(Json(ViewBag.ObjTransporterList)); }
public virtual ActionResult Create(Transporter transporter) { if (_transporterService.IsNameValid(transporter.TransporterID, transporter.Name)) { ModelState.AddModelError("Name", "Transporter Name should be Unique"); } if (ModelState.IsValid) { _transporterService.AddTransporter(transporter); return(Json(new { sucess = true })); } return(PartialView(transporter)); //if (!repository.Transporter.IsNameValid(transporter.TransporterID, transporter.Name)) //{ // ModelState.AddModelError("Name", "Transporter Name should be Unique"); //} //if (ModelState.IsValid) //{ // repository.Transporter.Add(transporter); // return Json(new { success = true }); //} //return PartialView(transporter); }
public void TransporterTest() { Transporter transporter = new Transporter(); transporter.SetupTest(); transporter.TheTransporterTest(); transporter.TeardownTest(); }
public ActionResult Edit(Transporter transporter, string strExperienceFrom, string strExperienceTo) { DateTime ExperienceFrom; DateTime ExperienceTo; /* try * { * ExperienceFrom = DateTime.Parse(strExperienceFrom); * ExperienceTo = DateTime.Parse(strExperienceTo); * //OpeningDate = DateTime.Parse(Opening); * } * catch (Exception) * { * getGregorianDate EthData = new getGregorianDate(); * ExperienceFrom = EthData.ReturnGregorianDate(strExperienceFrom); * ExperienceTo = EthData.ReturnGregorianDate(strExperienceTo); * }*/ if (ModelState.IsValid) { if (transporter.TransporterID == 0) { transportService.AddTransporter(transporter); } else { // transporter.ExperienceFrom = ExperienceFrom; // transporter.ExperienceTo = ExperienceTo; transportService.EditTransporter(transporter); } return(RedirectToAction("Index")); } return(View(transporter)); }
public ActionResult EditAccount(EditProfileModel editProfileModel) { Transporter thisUser = (Transporter)Session["loggedInUser"]; if (ModelState.IsValid) { Transporter user = new Transporter(); user.Name = editProfileModel.Name; user.DateOfBirth = editProfileModel.DateofBirth; user.Gender = editProfileModel.Gender; user.Password = thisUser.Password; user.Id = thisUser.Id; user.Email = thisUser.Email; user.Status = thisUser.Status; user.Points = thisUser.Points; user.LastOnline = DateTime.Now; transporterService.Update(user, user.Id); Session["loggedInUser"] = user; return(RedirectToAction("Index", "Transporter")); } ViewBag.dobDay = Convert.ToInt32(thisUser.DateOfBirth.Split('/')[0]); ViewBag.dobMonth = Convert.ToInt32(thisUser.DateOfBirth.Split('/')[1]); ViewBag.dobYear = Convert.ToInt32(thisUser.DateOfBirth.Split('/')[2]); return(View(editProfileModel)); }
public bool DeleteByT(Transporter t) { _context.Transporters.Remove(t); var result = Save(); return(result); }
public async Task <DeviceDescriptionPayload> Download(string channelId, DeviceVersion deviceVersion) { DeviceDescriptionPayload result = null; try { var query = HttpUtility.ParseQueryString(string.Empty); query["callerId"] = channelId; query["hardwareVersion"] = $"{deviceVersion.HardwareVersion}"; query["softwareVersion"] = $"{deviceVersion.SoftwareVersion}"; query["applicationNumber"] = $"{deviceVersion.ApplicationNumber}"; query["applicationVersion"] = $"{deviceVersion.ApplicationVersion}"; var url = UrlHelper.BuildUrl(Url, "api/description/download", query); var json = await Transporter.Get(_identity, url); if (!string.IsNullOrEmpty(json)) { result = json.TryDeserializeObject <DeviceDescriptionPayload>(); if (result != null) { result.Version = deviceVersion; } } } catch (Exception e) { MsgLogger.Exception($"{GetType().Name} - Download", e); } return(result); }
public async Task <bool> Exists(DeviceDescriptionPayload deviceDescription) { bool result = false; try { var query = HttpUtility.ParseQueryString(string.Empty); query["callerId"] = deviceDescription.ChannelId; query["nodeId"] = $"{deviceDescription.NodeId}"; query["hashCode"] = deviceDescription.HashCode; var url = UrlHelper.BuildUrl(Url, "api/description/exists", query); var json = await Transporter.Get(_identity, url); if (!string.IsNullOrEmpty(json)) { var requestResult = json.TryDeserializeObject <RequestResult>(); if (requestResult != null) { result = requestResult.Result; } } } catch (Exception e) { MsgLogger.Exception($"{GetType().Name} - Exists", e); } return(result); }
internal async Task <bool> PayloadExists(DeviceToolPayload payload) { bool result = false; try { var query = HttpUtility.ParseQueryString(string.Empty); query["callerId"] = payload.ChannelId; query["nodeId"] = $"{payload.NodeId}"; query["uniqueId"] = payload.Id; query["hashCode"] = payload.HashCode; query["mode"] = $"{payload.Mode}"; query["type"] = $"{payload.Type}"; var url = UrlHelper.BuildUrl(Url, "api/description/payload-exists", query); result = await Transporter.Get(_identity, url, CancellationToken.None); } catch (Exception e) { MsgLogger.Exception($"{GetType().Name} - PayloadExists", e); } return(result); }
public void Notify_FuelingPortSourceDeSpawned() { if (Transporter.CancelLoad()) { Messages.Message("MessageTransportersLoadCanceled_FuelingPortGiverDeSpawned".Translate(), parent, MessageTypeDefOf.NegativeEvent); } }
// // GET: /Transporter/Details/5 public virtual ViewResult Details(int id) { Transporter transporter = _transporterService.FindById(id); // Transporter transporter = repository.Transporter.FindById(id); return(View(transporter)); }
public Transporter CreateTransporter(double x1, double y1, double x2, double y2) { Transporter transporter = new Transporter(6f, 2f, true, (x1 + x2) / 2, (x1 + x2) / 2, x1, y1, x2, y2); CreateTransporterRenderer(x1, y1, x2, y2, transporter); return(transporter); }
public static void Run() { int num = 10; Transporter tc = new Transporter(null, process); List <byte[]> list; byte[] buffer = generateBuffers(num, out list); int offset = 0; while (offset < buffer.Length) { int length = 200; length = (offset + length) > buffer.Length ? buffer.Length - offset : length; tc.ProcessBytes(buffer, offset, offset + length); offset += length; } if (!check(list)) { Console.WriteLine("Transport test failed!"); } else { Console.WriteLine("Transport test success!"); } }
protected void btnSave_Click(object sender, EventArgs e) { Transporter transporter = new Transporter(); if (Profile_LegalEntity1.CompanyProfileEntity != null) originalTransporter = manager.GetTransporterByLegalEntityProfile(Company.CompanyId, Profile_LegalEntity1.CompanyProfileEntity.LegalEntityProfileId); else if (Page.ViewState["TransporterId"] != null) originalTransporter = manager.GetTransporter(Convert.ToInt32(Page.ViewState["TransporterId"])); if (originalTransporter != null) transporter.CopyPropertiesFrom(originalTransporter); transporter.CompanyId = Company.MatrixId.Value; transporter.ModifiedDate = DateTime.Now; transporter.LegalEntityProfileId = Profile_LegalEntity1.CompanyProfileEntity.LegalEntityProfileId; // // Add entity for insert // if (transporter.LegalEntityProfileId == 0) transporter.LegalEntityProfile = Profile_LegalEntity1.CompanyProfileEntity; if (Page.ViewState["TransporterId"] == null && Page.ViewState["ProfileExists"] != "0") manager.Insert(transporter); else { manager.Update(originalTransporter, transporter); } Response.Redirect("Transporters.aspx"); }
public ActionResult EditTransporter(EditProfileModel user, FormCollection form) { if (ModelState.IsValid) { int tid = adminrepo.GetIdFromEmail <Transporter>(user.Email); Transporter transporterToEdit = trepo.Get(tid); transporterToEdit.Name = user.Name; transporterToEdit.Gender = user.Gender; transporterToEdit.Status = user.Status; string year = form["dobYear"]; string month = form["dobMonth"]; string day = form["dobDay"]; transporterToEdit.DateOfBirth = day + "/" + month + "/" + year; trepo.Update(transporterToEdit, transporterToEdit.Id); TempData["success"] = "User Edited Successfully"; return(RedirectToAction("SearchTransporter", "Admin")); } return(View(user)); }
public bool DeleteTransporter(Transporter entity) { if(entity==null) return false; _unitOfWork.TransporterRepository.Delete(entity); _unitOfWork.Save(); return true; }
private TContract CreateProxyContract(Transporter light) { var memebers = ProxyContractFactory.ParseContractInterface(typeof(TContract)); var dispatcher = _contractBuilder.ReceiveDispatcherFactory(); var outputMessages = memebers.GetMethods().Select(m => new MessageTypeInfo { ReturnType = m.Value.ReturnType, ArgumentTypes = m.Value.GetParameters().Select(p => p.ParameterType).ToArray(), MessageId = (short)m.Key }); var inputMessages = memebers.GetProperties().Select(m => new MessageTypeInfo { ArgumentTypes = ReflectionHelper.GetDelegateInfoOrNull(m.Value.PropertyType).ParameterTypes, ReturnType = ReflectionHelper.GetDelegateInfoOrNull(m.Value.PropertyType).ReturnType, MessageId = (short)m.Key }); var messenger = new Messenger( light, SerializerFactory.CreateDefault(_contractBuilder.UserSerializationRules.ToArray()), DeserializerFactory.CreateDefault(_contractBuilder.UserDeserializationRules.ToArray()), outputMessages: outputMessages.ToArray(), inputMessages: inputMessages.ToArray() ); var interlocutor = new Interlocutor(messenger, dispatcher, _contractBuilder.MaxAnswerTimeoutDelay); var contract = ProxyContractFactory.CreateProxyContract <TContract>(interlocutor); return(contract); }
public static void EncodeTest3() { Animal a = new Animal(); a.legs = 4; Animal b = new Animal(); a.legs = 2; Mission m; m.target = "unknown"; m.start = new DateTime(2020, 4, 1); Transporter <Animal> t = new Transporter <Animal>(); t.Mission = m; t.cargo = new Animal[] { a, b }; t.driver.Add("Joe"); string json = Json.Encode(t); Console.WriteLine("json = " + json); Assert.AreEqual("{\"mission\":{\"target\":\"unknown\",\"start\":\"2020-03-31T22:00:00.000Z\"},\"cargo\":[{\"legs\":2,\"kind\":0},{\"legs\":0,\"kind\":0}],\"maxCargo\":null,\"driver\":[\"Joe\"]}", json); }
public IConnection <TContract, TChannel> Build() { var channel = _channelFactory(); var light = new Transporter(channel); TContract contract = null; if (_contractBuilder.OriginContractFactory == null) { contract = CreateProxyContract(light); } else { contract = CreateOriginContract(light); } _contractBuilder.ContractInitializer(contract, channel); if (channel.IsConnected) { channel.AllowReceive = true; } return(new Connection <TContract, TChannel>(contract, channel, _contractBuilder.ContractFinalizer)); }
protected void bttnSignIn_Click(object sender, EventArgs e) { if (Page.IsValid) { try { using (MasterContext context = new MasterContext()) { var user = context.Hasta.FirstOrDefault(x => x.TckNo == txtBoxTckNo.Text && x.Sifre == txtBoxPass.Text); if (user != null) { // kullanıcı var Transporter transporter = new Transporter(); transporter.Id = user.Id; transporter.TckNo = user.TckNo; transporter.Sifre = user.Sifre; Session.Add("Account", transporter); Page.Response.Write("kullanıcı var session oluşturuldu, yönlendirme sayfası yazılmadı"); } else { Page.Response.Write("böyle bir kullanıcı yok yönlendirme sayfası yazılmadı"); } } } catch { Page.Response.Write("Oturum açma hatası!!!"); } } }
public static Transporter CreateTransporter() { // Create a transporter. Transporter t = new Transporter(); return(t); }
void OnTriggerExit(Collider col) { available = true; ring.renderer.material.color = Color.green; destination = null; // pass parenting to containing object, or null if no containing object col.transform.parent = transform.parent; }
// Use this for initialization void Start () { transporter = null; xDeg = 0.0f; yDeg = 0.0f; mainCam = GetComponentInChildren<Camera>(); if (mainCam == null) print ("Could not find camera"); activateTransporter = false; }
void OnTriggerEnter(Collider col) { available = false; ring.renderer.material.color = Color.red; col.transform.parent = transform; destination = registry.findNearestAvailable(this); // need to give callback to player in transporter if (col.tag == "Player") { PlayerControl pc = col.GetComponent<PlayerControl>(); pc.transporter = this; } }
public Transporter findNearestAvailable(Transporter reqTransporter) { float shortestDist = 1e7f; Transporter nearestTransporter = null; foreach (Transporter t in transporters) { float distance = Vector3.Distance(t.transform.position,reqTransporter.transform.position); if ((distance < shortestDist) && (t != reqTransporter)) { shortestDist = distance; nearestTransporter = t; } } return nearestTransporter; }
void OnTriggerEnter(Collider other) { if(other.gameObject.GetComponent("Client") != null) //You can change this script to any script that only the player has { Debug.Log("Colliding"); if (PowerUpType == (int) PowerUps.LT_TRANS) { Transporter trans = new Transporter(); trans.Activate(character, spawnpoint); } else if(PowerUpType == (int) PowerUps.LT_EXPL) { Dynamite exp = new Dynamite(); exp.Activate(); } } }
protected void txtTransporter_TextChanged(object sender, EventArgs e) { OnSelectingTransporter(this, new SelectingTransporterEventArgs() { TransporterName = txtTransporter.Text }); ProfileManager profileManager; if (txtTransporter.Text.Contains('|')) { profileManager = new ProfileManager(this); transporterManager = new TransporterManager(this); string[] identifications = txtTransporter.Text.Split('|'); string identification = identifications[0].ToString().Trim(); LegalEntityProfile legalEntityProfile = profileManager.GetLegalEntityProfile(identification); if (legalEntityProfile != null) transporter = transporterManager.GetTransporterByLegalEntityProfile(Page.Company.CompanyId, legalEntityProfile.LegalEntityProfileId); ShowTransporter(transporter); } }
void ChangeTransporterDestination(Transporter a, Transporter b, string roomName) { a.ChangeDestination(b.transform, "transport to " + roomName); }
// Use this for initialization void Start () { registry = GameObject.FindGameObjectWithTag("TransporterRegistry").GetComponent<TransporterRegistry>(); ring.renderer.material.color = Color.green; destination = null; }
public void Add(Transporter newOne) { newOne.tag = "Transporter"; transporters.Add(newOne); }
// Update is called once per frame void FixedUpdate () { xDeg += (Input.GetAxis ("Mouse X") * maxRotationForce); yDeg += -1.0f * Input.GetAxis ("Mouse Y") * maxRotationForce; yDeg = Limiter(yDeg, minYDeg, maxYDeg); // rotate player only in x axis //toRotation = Quaternion.Euler(yDeg, xDeg, 0); toRotation = Quaternion.Euler(0, xDeg, 0); transform.rotation = toRotation; // camera tilt only in both x and y axis cameraTilt = Quaternion.Euler (yDeg,xDeg,0); mainCam.transform.rotation = cameraTilt; //print ("xDeg = " + xDeg + " yDeg = " + yDeg); float v = DeadZone(Input.GetAxis("Vertical"),-0.1f,0.1f); // determine forward force Vector3 forwardForceVec; if (transform.parent != null) { // if object is a child of a parent FOV, convert forward based on that FOV forwardForceVec = transform.parent.TransformDirection (transform.forward) * v * maxTravelForce; } else { forwardForceVec = transform.forward * v * maxTravelForce; } rigidbody.AddForce(forwardForceVec); // determine up force Vector3 upForceVec; if (Input.GetKey (KeyCode.Space)) { if (transform.parent != null) { // if object is a child of a parent FOV, convert up based on that FOV upForceVec = transform.parent.TransformDirection (transform.up) * maxJumpForce; } else { upForceVec = transform.up * maxJumpForce; } rigidbody.AddForce(upForceVec); } // player wants to activate transporter if (Input.GetKey (KeyCode.E) && (!activateTransporter)) { activateTransporter = true; startTime = Time.time; } // slow down teleport by 0.25 s if ((activateTransporter) && (Time.time - startTime > 0.25f)) { if (transporter != null) { transporter.Activate(this.gameObject); transporter = null; } activateTransporter = false; } }
public bool EditTransporter(Transporter entity) { _unitOfWork.TransporterRepository.Edit(entity); _unitOfWork.Save(); return true; }
//this code will need to be changed if I plan on blending any else void SpawnTransporter() { //deals with creating the transporter as well as the animation stuff relating to that if(anim.GetCurrentAnimatorStateInfo(0).IsTag("Running") && anim.GetNextAnimatorStateInfo(0).IsName("IdleToShoot") || anim.GetCurrentAnimatorStateInfo(0).IsTag("InAir") && anim.GetNextAnimatorStateInfo(0).IsName("IdleToShoot")){ //if you are running and about to shoot, turn on the mask anim.SetLayerWeight (1,1); //_lowerBodyBlendTarget = 1; } if (!anim.GetCurrentAnimatorStateInfo(0).IsTag("Shooting") && anim.GetLayerWeight(1) > 0 && !anim.IsInTransition(0)){ //anim.GetCurrentAnimatorStateInfo (0).IsName ("ShootLoop") && anim.IsInTransition (0)) { //no longer blend anim.SetLayerWeight(1,0); //_lowerBodyBlendTarget = 0; } if(anim.GetCurrentAnimatorStateInfo(0).IsTag("Shooting")){ //face the camera when you shot FaceCameraWhenShooting(); } if(anim.GetCurrentAnimatorStateInfo(0).IsName("ShootLoop") && anim.GetBool("Shooting")){ //now firing the gun anim.SetBool("Shooting",false); //can only fire so often if (_port != null) { //turn off the old teleporter _port.Inactive(); } GameObject _porterObj = Instantiate (transporterPrefab) as GameObject; _port = _porterObj.GetComponent<Transporter> (); _port.transform.position = thorwOrigin.position; Vector3 _fireDirection = new Vector3 (transform.forward.x, cameraTrans.forward.y, transform.forward.z); _port.rigid.velocity = _rigid.velocity + new Vector3 (0, throwUp, 0) + _fireDirection.normalized * throwForward; } }