public void Awake() { if (CoverController.instance) { Destroy(this.gameObject); return; } CoverController.instance = this; this.sprite = this.GetComponent <SpriteRenderer>(); this.FadeIn(); }
public HttpResponseMessage AddQuotationCoverDetails(PostQuotationCoverRequest postQuotationCoverRequest) { // api/QuotationCover/AddQuotationCoverDetails?jobId=54163&RevisionId=0 var uIdentity = Thread.CurrentPrincipal.Identity; UserAccountController uc = new UserAccountController(); UserAccount user = uc.getUserFromUserName(uIdentity.Name.ToString()); QuotationMainTakafulController quotationMainController = new QuotationMainTakafulController(); QuotationMainTakaful quotationMain; CoverController coverController = new CoverController(); List <Cover> allowedCoverList = coverController.GetAllowedCovers(user.Company); DeleteCovers(Convert.ToInt32(postQuotationCoverRequest.JobId), Convert.ToInt32(postQuotationCoverRequest.RevisionId)); foreach (QuotationCover cover in postQuotationCoverRequest.QuotationCovers) { if (cover.Cover == "chk4" || cover.Cover == "chk5" || cover.Cover == "chk8") { if (!validateCoverAmount(cover.Cover, cover.Amount)) { var message = string.Format("Amount of cover {0} not in the allowed range", cover.Cover); HttpError err = new HttpError(message); return(Request.CreateResponse(HttpStatusCode.NotAcceptable, err)); } } //To validate the allowed covers var item = allowedCoverList.Find(x => x.CoverCode == cover.Cover); if (item == null) { continue; } /////////// OracleConnection con = new OracleConnection(ConnectionString); try { con.Open(); OracleCommand cmd = null; cmd = new OracleCommand("MNB_T_INSERT_MTR_COVER_DETAILS"); cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = con; cmd.Parameters.Add("jobid", OracleType.Int32).Value = cover.JobId; cmd.Parameters.Add("revision_id", OracleType.VarChar).Value = cover.RevisionId; cmd.Parameters.Add("cover", OracleType.VarChar).Value = cover.Cover; cmd.Parameters.Add("pol_type", OracleType.VarChar).Value = cover.Type; cmd.Parameters.Add("amount", OracleType.VarChar).Value = cover.Amount; cmd.ExecuteNonQuery(); con.Close(); //saveDefaultCovers(postQuotationCoverRequest.JobId, user); } catch (Exception ex) { con.Close(); return(Request.CreateResponse(HttpStatusCode.ExpectationFailed)); } } return(Request.CreateResponse(HttpStatusCode.OK)); }
void Start() { renderer = GetComponent<SpriteRenderer> (); currentLife = initiaLife; positionOne = transform.position; positionOne.x -= 0.8f; positionTwo = transform.position; positionTwo.x += 0.8f; if (nextUp == null) nextUp = this; if (next == null) next = this; if (nextDown == null) nextDown = this; }
public void NewCover(CoverController _cover) { if (this.rigidBody == null) { this.rigidBody = GetComponent<Rigidbody2D> (); } this.rigidBody.gravityScale = 0; if (this.cover != null) { this.cover.OffCover (); } _cover.OnCover (); this.cover = _cover; this.currentState = State.TRANSITIONING; this.lastPosition = transform.position; // hitCollider.SetActive (true); this.collider.enabled = false; if (!rightCoverSide) { this.target = _cover.PositionOne; } else { this.target = _cover.PositionTwo; } this.movingSpeed = this.target - this.lastPosition; this.movingSpeed.Normalize (); this.movingSpeed *= this.transitionSpeed; rigidBody = GetComponent<Rigidbody2D> (); rigidBody.velocity = Vector2.zero; animator.Play ("idle"); }
private void SelectCover() { //Stand up _anim.SetBool("isCrouching", false); _aiWeapon.SetTarget(null); _aiWeapon.SetFiring(false); //Clear the change cover timer _changeCoverTimer = 0.0f; //Remove the AI from their current cover if (_currentCover) { _currentCover.RemoveUser(); } CoverController closestCover = null; float closestDistance = 10000.0f; //Cycle through each cover in the array foreach (CoverController cover in _coversInZone) { if (_currentCover != null && _currentCover == cover) { continue; } //If the cover is full then don't go to this cover if (cover.IsFull) { continue; } //Calculate the distance between the agent and the cover float distance = Vector3.Distance(_agent.transform.position, cover.transform.position); //if the distance from this cover is less than the distance from the closest cover if (distance < closestDistance) { //Set the new closest cover closestCover = cover; closestDistance = distance; } } //Set our new cover _currentCover = closestCover; if (_currentCover != null) { //Move the agent to the cover _currentCover.AddUser(); //Find the cover point which is furthest away from the player float furthestCoverPointDistance = 0.0f; Transform furthestCoverPoint = _currentCover.GetCoverPoints()[0]; foreach (Transform coverPoint in _currentCover.GetCoverPoints()) { //Get the distance from the player to the cover points float distance = Vector3.Distance(_agent.Player.position, coverPoint.transform.position); //Find the furthest one if (distance > furthestCoverPointDistance) { furthestCoverPoint = coverPoint; furthestCoverPointDistance = distance; } } //Move to the cover point _navAgent.SetDestination(furthestCoverPoint.position); } }
public void Setup() { fileInstrumenter = Substitute.For<FileInstrumenter>(false); fileListBuilder = Substitute.For<FileListBuilder>(); diskIo = Substitute.For<IDisk>(); settings = new Settings(); controller = new CoverController(settings, fileListBuilder, diskIo); }