public void GoAirCraftMode(AirCraft a) { this.camMode = CamMode.AirCraft; this.transform.SetParent (null, true); this.aircraft = a.transform; this.target = a.CamTarget; }
public void RegisterAirCraftUnderGuidance(AirCraft aircraft) { if (!allAirCraftsUnderGuidance.Contains(aircraft)) { allAirCraftsUnderGuidance.Add(aircraft); } }
public async Task <HttpResponseMessage> AddFlight([FromBody] FlightInput flightInput) { var geometry = BsonDocument.Parse(flightInput.Geo.ToString()); AirCraft airCraft = await AirCraftRepository.GetAirCraftById(new ObjectId(flightInput.AircraftId)); Flight flight = new Flight() { Aircraft = airCraft, Altitude = flightInput.Altitude, Date = Convert.ToDateTime(flightInput.Date).ToUniversalTime(), Duration = flightInput.Duration, Geo = new GeoBson() { type = geometry["Type"].AsString, coordinates = new BsonArray(geometry["Coords"].AsBsonArray) } }; if (await FlightRepository.AddFlight(flight)) { return(Request.CreateResponse(HttpStatusCode.OK, "Successfully Added!")); } else { return(Request.CreateResponse(HttpStatusCode.InternalServerError, "While adding new Flight, error occurred!")); } }
public async Task AddSchedules(string scheduleFromDate, string scheduleToDate) { TimeSpan timeAccessory = new TimeSpan(0, 0, 0); DateTime fromDate = Convert.ToDateTime(scheduleFromDate + " " + timeAccessory); DateTime toDate = Convert.ToDateTime(scheduleToDate + " " + timeAccessory); AirCraft airCraft = new AirCraft(); for (var dt = fromDate; dt <= toDate; dt = dt.AddDays(1)) { //var dt = DateTime.Now; foreach (var r in _context.Routes) { for (var i = 0; i < 4; i++) { DateTime tempDepartDateTime = Convert.ToDateTime(dt.Date.ToString("d") + " " + GenerateDepartTime()); DateTime tempArriveDateTime = tempDepartDateTime.Add(r.AveDuration); int ramID = GenerateAirCraftID(); airCraft = _context.AirCrafts.Where(a => a.AirCraftID == ramID).FirstOrDefault(); //随机选取一个飞机 await _context.Flight_Schedules.AddAsync(new Flight_Schedule { RouteID = r.RouteID, DepartDateTime = tempDepartDateTime, ArriveDateTime = tempArriveDateTime, AirlineCode = RandomString(2) + RandomInt(3), AirCraftID = airCraft.AirCraftID, NetFaire = r.BasicFare, Economy = airCraft.EconomyCap, Business = airCraft.BusinessCap, PremEconomy = airCraft.PremEconomyCap, First = airCraft.FirstCap }); } //_context.SaveChanges(); } } _context.SaveChanges(); }
public override int Traverse() { if (useIDInput) { if (useIDInput && IDInput == null) { IDInput = inputKnobs[1]; } if (IDInput.connected()) { entityID = (IDInput.connections[0].body as SpawnEntityNode).entityID; } else { Debug.LogWarning("Name Input not connected!"); } } Debug.Log("Entity ID: " + entityID); Debug.Log("Target ID: " + targetEntityID); if (!(target && entity)) // room for improvement but probably unecessary { foreach (var ent in AIData.entities) { if (ent is AirCraft airCraft) { if (ent.ID == entityID) { entity = airCraft; } } if (ent.ID == targetEntityID) { target = ent; } } } //Debug.LogError(target + " " + entity); if (entity && entity.GetComponent <TractorBeam>() && target) { entity.GetComponentInChildren <TractorBeam>().ForceTarget(target.transform); } else if (entity && entity.GetComponent <TractorBeam>()) { entity.GetComponentInChildren <TractorBeam>().ForceTarget(null); } else { Debug.LogError(entity + " " + entity.GetComponentInChildren <TractorBeam>()); } return(0); }
public void Attack(AirCraft target) { if (this.Pilot.Color == target.Pilot.Color) { return; } target.Pilot.Health -= this.Damage; }
public int Delete(AirCraft value) { string sql = "DELETE FROM [T_AirCraft] WHERE [ID]=@ID "; using (var dbOperate = new DbOperator(Provider, ConnectionString)) { dbOperate.AddParameter("ID", value.Id); return(dbOperate.ExecuteNonQuery(sql)); } }
public void Attack(AirCraft target) // method { if (this.Pilot.Color == target.Pilot.Color) // for not attacking own team { return; } target.Pilot.Health -= this.Damage; }
public void DropAirCraftControl(GravitationalObject g) { this.transform.SetParent (g.transform, true); this.grav = g; this.airCraft = null; this.playerMode = Player.PlayerState.Move; this.SetKinematic (false); }
public void ReciveOtherAirCraftLocation(AirCraft reportingAirCraftLocation) { foreach (var airCraft in allAirCraftsUnderGuidance.Where(x => x.CallSign != reportingAirCraftLocation.CallSign)) { if (Math.Abs(airCraft.Altitude - reportingAirCraftLocation.Altitude) < 1000) { airCraft.WarnIntrusionAirSpaceBy(reportingAirCraftLocation); } } }
public void DropAirCraftControl(GravitationalObject g) { this.transform.SetParent(g.transform, true); this.grav = g; this.airCraft = null; this.playerMode = Player.PlayerState.Move; this.SetKinematic(false); }
public async Task <HttpResponseMessage> GetAirCraftById(string id) { AirCraft airCraft = await AirCraftRepository.GetAirCraftById(new ObjectId(id)); if (airCraft == null) { return(Request.CreateResponse(HttpStatusCode.NotFound, "Error, AirCraft couldn't find!")); } return(Request.CreateResponse <AirCraft>(HttpStatusCode.OK, airCraft)); }
public async Task <HttpResponseMessage> AddAirCraft(AirCraft airCraft) { bool insterted = await AirCraftRepository.AddAirCraft(airCraft); if (insterted) { return(Request.CreateResponse(HttpStatusCode.OK, "Successfully added")); } return(Request.CreateResponse(HttpStatusCode.InternalServerError, "While adding new aircraft, error occurred!")); }
public async Task <HttpResponseMessage> UpdateAirCraft(AirCraft airCraft) { bool updated = await AirCraftRepository.UpdateAirCraft(airCraft); if (updated) { return(Request.CreateResponse(HttpStatusCode.OK, "Successfully updated.")); } return(Request.CreateResponse(HttpStatusCode.InternalServerError, "While updating aircraft, error occurred!")); }
public static void AddAirCraft(AirCraftView airCraftView, string account) { var airCraft = AirCraft.GetAirCraft(airCraftView); if (QueryAirCraft(airCraft.Code) != null) { throw new ChinaPay.Core.Exception.KeyRepeatedException("机型[" + airCraft.Code.Value + "]已存在"); } AirCraftCollection.Instance.Add(airCraft.Id, airCraft); saveAddLog("机型", airCraft.ToString(), airCraft.Id.ToString(), account); }
public static async Task <bool> UpdateAirCraft(AirCraft newAirCraft) { var filter = Builders <AirCraft> .Filter.Eq("_id", new ObjectId(newAirCraft.Id)); var update = Builders <AirCraft> .Update.Set("NickName", newAirCraft.NickName) .Set("Camera", newAirCraft.Camera) .Set("CameraModel", newAirCraft.CameraModel); var result = await airCraftCollection.UpdateManyAsync(filter, update); return(result.ModifiedCount != 0); }
public void TakeAirCraftControl(AirCraft a) { this.airCraft = a; this.SetKinematic(true); this.transform.SetParent(a.transform, true); this.transform.localPosition = Vector3.zero; this.transform.localRotation = Quaternion.identity; this.playerMode = Player.PlayerState.PilotAirCraft; a.TakeOff(this); }
public static async Task <bool> AddAirCraft(AirCraft airCraft) { try { await airCraftCollection.InsertOneAsync(airCraft); return(true); } catch (Exception) { return(false); } }
void OnCollisionEnter(Collision collision) { if (collision.collider.tag == "AirCraft") { AirCraft air = collision.collider.gameObject.GetComponent <AirCraft>(); air.manageAirCraft.Lines[air.currentLine] = false; } ContactPoint contact = collision.contacts[0]; Quaternion rot = Quaternion.FromToRotation(Vector3.up, contact.normal); Vector3 pos = contact.point; Instantiate(explosionPrefab, pos, rot); Destroy(gameObject); Destroy(collision.gameObject); }
public void AirCraftTest() { //AirCraft class will be set up and information passed in to check the setup was correct. AirCraft aircraft = new AirCraft("B-52", 185000, 100000); string actualAirCraft = aircraft.getName(); string target = "B-52"; int actualWeight = aircraft.getWeight(); int targetWeight = 185000; int actualFuel = aircraft.getAvailableFuel(); int targetFuel = 100000; Assert.AreEqual(target, actualAirCraft, "Air Craft name is different"); Assert.AreEqual(actualWeight, targetWeight, "Air Craft Weight do not match"); Assert.AreEqual(actualFuel, targetFuel, "Fuel is different then expected"); }
static void InsertAircraft() { var aircraft = new AirCraft { Name = "F-16", Winspan = 9.96m, Description = "The General Dynamics F-16 Fighting Falcon " + "is a single-engine multirole fighter aircraft" }; using (var context = new AirCraftContext()) { context.Aircrafts.Add(aircraft); context.SaveChanges(); } }
public ActionResult Edit(AirCraft airCraft) { try { _iAirCraftRepo.UpdateAirCraft(airCraft); return(ErrorMessage.GetCustomeMessage(true, "AirCraft updated Successfully")); } catch (UniqueKeyException) { return(ErrorMessage.GetGenericEditFailed("AirCraftId")); } catch (DbEntityValidationException) { return(ErrorMessage.GetGenericModalFailed()); } }
public ActionResult Create(AirCraft airCraft) { try { airCraft.Status = (int)GeneralUtils.AirCraftStatus.WaitingToTakeOff; airCraft.FuelPercentage = 100; _iAirCraftRepo.AddAirCraft(airCraft); return(ErrorMessage.GetCustomeMessage(true, "Air Craft Created Successfully")); } catch (UniqueKeyException) { return(ErrorMessage.GetGenericCreatedFailed("AirCraftId")); } catch (DbEntityValidationException) { return(ErrorMessage.GetGenericModalFailed()); } }
public IHttpActionResult Create(AirCraftModel airCraft) { if (!this.ModelState.IsValid) { return(BadRequest(ModelState)); } var newAirCraft = new AirCraft { Model = airCraft.Model }; this.data.AirCrafts.Add(newAirCraft); this.data.AirCrafts.SaveChanges(); airCraft.Id = newAirCraft.Id; return(Ok(newAirCraft)); }
public int Update(AirCraft value) { string sql = "UPDATE [T_AirCraft] SET [CODE]=@CODE,[NAME]=@NAME,[AIRPORTFEE]=@AIRPORTFEE,[MANUFACTURER]=@MANUFACTURER,[DESCRIPTION]=@DESCRIPTION,[VALID]=@VALID WHERE [ID]=@ID"; using (var dbOperator = new DbOperator(Provider, ConnectionString)) { dbOperator.AddParameter("ID", value.Id); if (value.Code.IsNullOrEmpty()) { dbOperator.AddParameter("CODE", DBNull.Value); } else { dbOperator.AddParameter("CODE", value.Code.Value); } if (string.IsNullOrEmpty(value.Name)) { dbOperator.AddParameter("NAME", DBNull.Value); } else { dbOperator.AddParameter("NAME", value.Name); } dbOperator.AddParameter("AIRPORTFEE", value.AirportFee); if (string.IsNullOrEmpty(value.Manufacturer)) { dbOperator.AddParameter("MANUFACTURER", DBNull.Value); } else { dbOperator.AddParameter("MANUFACTURER", value.Manufacturer); } if (string.IsNullOrEmpty(value.Description)) { dbOperator.AddParameter("DESCRIPTION", DBNull.Value); } else { dbOperator.AddParameter("DESCRIPTION", value.Description); } dbOperator.AddParameter("VALID", value.Valid); return(dbOperator.ExecuteNonQuery(sql)); } }
public int Insert(AirCraft value) { string sql = "INSERT INTO [T_AirCraft]([ID],[CODE],[NAME],[AIRPORTFEE],[MANUFACTURER],[DESCRIPTION],[VALID]) VALUES (@ID,@CODE,@NAME,@AIRPORTFEE,@MANUFACTURER,@DESCRIPTION,@VALID)"; using (var dbOperator = new DbOperator(Provider, ConnectionString)) { dbOperator.AddParameter("ID", value.Id); if (value.Code.IsNullOrEmpty()) { dbOperator.AddParameter("CODE", DBNull.Value); } else { dbOperator.AddParameter("CODE", value.Code.Value); } if (string.IsNullOrEmpty(value.Name)) { dbOperator.AddParameter("NAME", DBNull.Value); } else { dbOperator.AddParameter("NAME", value.Name); } dbOperator.AddParameter("AIRPORTFEE", value.AirportFee); if (string.IsNullOrEmpty(value.Manufacturer)) { dbOperator.AddParameter("MANUFACTURER", DBNull.Value); } else { dbOperator.AddParameter("MANUFACTURER", value.Manufacturer); } if (string.IsNullOrEmpty(value.Description)) { dbOperator.AddParameter("DESCRIPTION", DBNull.Value); } else { dbOperator.AddParameter("DESCRIPTION", value.Description); } dbOperator.AddParameter("VALID", value.Valid); return(dbOperator.ExecuteNonQuery(sql)); } }
public static void UpdateAirCraft(Guid id, AirCraftView airCraftView, string account) { var airCraft = AirCraft.GetAirCraft(id, airCraftView); var originalAirCraft = QueryAirCraft(id); if (null == originalAirCraft) { throw new ChinaPay.Core.CustomException("原机型不存在"); } var sameCodeAirCraft = QueryAirCraft(airCraft.Code); if (sameCodeAirCraft != null && sameCodeAirCraft.Id != id) { throw new ChinaPay.Core.Exception.KeyRepeatedException("机型[" + airCraft.Code.Value + "]已存在"); } var originalContent = originalAirCraft.ToString(); AirCraftCollection.Instance.Update(airCraft.Id, airCraft); saveUpdateLog("机型", originalContent, airCraft.ToString(), airCraft.Id.ToString(), account); }
public IHttpActionResult Create(AirCraftModel aircraft) { if (!this.ModelState.IsValid) { return BadRequest(ModelState); } var newAircraft = new AirCraft { Model = aircraft.Model }; this.data.Aircrafts.Add(newAircraft); this.data.SaveChanges(); aircraft.Id = newAircraft.Id; //this.aircrafts.Save return Ok(aircraft); }
public IEnumerable <KeyValuePair <Guid, AirCraft> > Query() { string sql = "SELECT [ID],[CODE],[NAME],[AIRPORTFEE],[MANUFACTURER],[DESCRIPTION],[VALID] FROM [T_AirCraft]"; var result = new List <KeyValuePair <Guid, AirCraft> >(); using (var dbOperator = new DbOperator(Provider, ConnectionString)) { using (var reader = dbOperator.ExecuteReader(sql)) { while (reader.Read()) { AirCraft item = new AirCraft(reader.GetGuid(0)); item.Code = reader.IsDBNull(1) ? string.Empty : reader.GetString(1); item.Name = reader.IsDBNull(2) ? string.Empty : reader.GetString(2); item.AirportFee = reader.GetDecimal(3); item.Manufacturer = reader.IsDBNull(4) ? string.Empty : reader.GetString(4); item.Description = reader.IsDBNull(5) ? string.Empty : reader.GetString(5); item.Valid = (bool)reader.GetValue(6); result.Add(new KeyValuePair <Guid, AirCraft>(item.Id, item)); } } } return(result); }
public void InisialAirCraft() { int AirType = Random.Range(0, airCraftObject.Length); int Point = Random.Range(0, spawnPoint.Length); GameObject cloneAirCraft = Instantiate(airCraftObject[AirType], spawnPoint[Point].transform.position, spawnPoint[Point].transform.rotation); currentAirCraft = cloneAirCraft.GetComponent <AirCraft>(); currentAirCraft.currentLine = 0; if (Point == 0)/// spawnpoint=leftpoint { currentAirCraft.direction = AirCraft.Direction.west; } if (Point == 1)/// spawnpoint=rightpoint { currentAirCraft.direction = AirCraft.Direction.east; } currentAirCraft.leftPoint = spawnPoint[0].transform; currentAirCraft.rightPoint = spawnPoint[1].transform; currentAirCraft.letMove = true; indexAir++; }
public void SetUpTest() { AirCraft SetUpAircraft = new AirCraft(); AirWeapons SetUpAirWeapons = new AirWeapons(); }
public void TakeAirCraftControl(AirCraft a) { this.airCraft = a; this.SetKinematic (true); this.transform.SetParent (a.transform, true); this.transform.localPosition = Vector3.zero; this.transform.localRotation = Quaternion.identity; this.playerMode = Player.PlayerState.PilotAirCraft; a.TakeOff (this); }
public override void ManualStart(AirCraft p_playerCS) { base.ManualStart(p_playerCS); float __min = maxSpeed - (maxSpeed * 0.6f); float __max = maxSpeed + (maxSpeed * 0.2f); maxSpeed = UnityEngine.Random.Range(__min, __max); _anim = body.GetComponent<Animator>(); _rigidbody = GetComponent<Rigidbody>(); _anim.enabled = false; _animRasante = Animator.StringToHash("Rasante"); collisionAround.onTrigger += delegate (GameObject p_player) { if (!_attack) { AirCraft __aircraft = p_player.transform.root.GetComponent<AirCraft>(); _rigidbody.velocity = Vector3.zero; player = __aircraft.airCraftBody; _goUp = false; _currentSpeed = 0f; _followPlayer = false; _attack = true; transform.LookAt(player.transform); _anim.SetBool(_animRasante, true); //_rigidbody.AddForce((player.transform.position - transform.position) * 300f, ForceMode.Impulse); } }; collisionAround.onExitArea += delegate { if (_attack) { _currentSpeed = 0f; _attack = false; _anim.SetBool(_animRasante, false); transform.LookAt(player.transform); } }; this.enabled = false; }
static void Main() { //Bunnies.Bunny ivanBunny = new Bunnies.Bunny(); // constructor, if there is not namespace using Bunnies; //Bunny peshoBunny = new Bunny(); // constructor => create new object bunny //Console.WriteLine(peshoBunny); // Bunnies.Bunny Bunny blueBunny = new Bunny("Ivan", ColorType.Blue); Bunny zayoBunny = new Bunny("Zayo"); //Console.WriteLine(zayoBunny); // Bunnies.Bunny //zayoBunny.ChangeColor("Red"); // this could be made by properties also ulong currentZayoCarrots = zayoBunny.AddCarrots(100); Console.WriteLine("Zayo carrots = " + currentZayoCarrots); Bunny bugsBunny = new Bunny("Bugs", ColorType.Red); ulong currentBugsCarrots = bugsBunny.AddCarrots(2000); Console.WriteLine("Bugs carrots = " + currentBugsCarrots); string zayoName = zayoBunny.Name; // we need property for that Console.WriteLine(zayoName); //zayoBunny.Name = "Koko"; // won't work because the property is read only (only get) ColorType color = zayoBunny.Color; // get zayoBunny.Color = ColorType.Red; // set zayoBunny.Health = 150; Console.WriteLine(zayoBunny.Health); Console.WriteLine(zayoBunny.isRetired); //zayoBunny.Retire(); zayoBunny.Health -= 250; zayoBunny.Retire(); Console.WriteLine(zayoBunny.isRetired); //Animal animal = new Animal(); // won't work because the class Animal is abstract //Console.WriteLine(Bunny.NumberOfLegs); //doesn't work because it's private //works, if it's: public static int NumberOfLegs = 4; but it's not ok to be public var chipiBunny = new Bunny("Chipi"); //Bunny chipiBunny = new Bunny("Chipi"); Console.WriteLine(chipiBunny.Health); // 100 ChangeBunny(chipiBunny); Console.WriteLine(chipiBunny.Health); // 0 // create a Bunny collection List <Bunny> bunnies = new List <Bunny>(); Random random = new Random(); for (int i = 0; i < 100; i++) { Bunny currentBunny = new Bunny(new string((char)i, 10)); currentBunny.Health = random.Next(0, 100); bunnies.Add(currentBunny); } //foreach (var bunny in bunnies) //{ // Console.WriteLine(bunny.Name + " " + bunny.Health); //} // initialize a list zayoAndChipi var zayoAndChipi = new List <Bunny> { zayoBunny, chipiBunny }; foreach (var bunny in zayoAndChipi) { Console.WriteLine(bunny.Name); } AirCraft firstAirCraft = new AirCraft(chipiBunny, 60); AirCraft secondAirCraft = new AirCraft(bugsBunny, 80); Console.WriteLine(secondAirCraft.Pilot.Health); // 100 firstAirCraft.Attack(secondAirCraft); // 40 Console.WriteLine(secondAirCraft.Pilot.Health); //AirCraft.Speed(); // this method exist, but firstAirCraft.Speed() don't, because the method Speed() is static firstAirCraft.Move(new Coordinates(15, 20)); secondAirCraft.Move(new Coordinates(25, 40)); double distance = AirCraft.CalculateDistance(firstAirCraft, secondAirCraft); Console.WriteLine(distance); Console.WriteLine(bugsBunny.Damage); ColorType colorType = ColorType.Red; Console.WriteLine(colorType); // Red Console.WriteLine((int)colorType); // 1 Bunny darkoBunny = new Bunny("Darko"); //Animal darkoBunny = new Bunny("Darko"); // works too, but not the same way, because Bunny is subclass to Animal //Console.WriteLine(darkoBunny); // Bunnies.Bunny - if there is not public override string ToString() in Bunny.cs Console.WriteLine(darkoBunny); // Darko 100 object bunnyAsObject = new Bunny("Obi"); Bunny obiBunny = bunnyAsObject as Bunny; // it's safer - if cast is impossible, returns null //Bunny obiBunny = (Bunny)bunnyAsObject; // if cast is impossible => exception Console.WriteLine(obiBunny.Name); // Obi if (obiBunny is Animal) { Console.WriteLine("Is animal"); } }
public virtual void ManualStart(AirCraft p_playerCS) { _lifeEventOne = energy - (energy * 0.2f); _lifeEventTwo = energy - (energy * 0.4f); _lifeEventThree = energy - (energy * 0.8f); }
public static void TwoAdapter() { IAircraft aircraft = new AirCraft(); aircraft.TakeOff(); if (aircraft.IsAirBrone) { Console.WriteLine("Aircraft engine is fine, fly at the height of "+aircraft.Height + " meters"); } //ISeaCraft seaCraft = new SeaCraft(); IAircraft seabird = new Seabird(); seabird.TakeOff(); ((ISeaCraft)seabird).IncreaseRev(); ((ISeaCraft)seabird).IncreaseRev(); ((ISeaCraft)seabird).IncreaseRev(); if (seabird.IsAirBrone) { Console.WriteLine("Seabird flying at height of " + seabird.Height + " meters and speed of " + ((ISeaCraft)seabird).Speed + " knots"); } }
// Use this for initialization public override void ManualStart(AirCraft p_playerCS) { base.ManualStart(p_playerCS); _playerCS = p_playerCS; _anim = body.GetComponent<Animator>(); _rigidbody = GetComponent<Rigidbody>(); _animPlan = Animator.StringToHash("Plan"); _animGrab = Animator.StringToHash("Grab"); _animSpit = Animator.StringToHash("Spit"); _animRoar = Animator.StringToHash("Roar"); _animDeath = Animator.StringToHash("Death"); _currentSpeed = 0; for (int i = 0; i < 200; i++) { int __num = i; _blood.Add(Instantiate(hitBloodPrefab, new Vector3(-2000, -2000, -2000), Quaternion.identity) as GameObject); _bloodParticle.Add(_blood[__num].GetComponent<ParticleSystem>()); _bloodParticle[__num].Stop(); _bloodParticleFree.Add(_bloodParticle[__num]); } collisionBody.onGrabCollision += delegate (Vector3 p_point) { if (!_grabing && !_isDead) { _grabing = true; Grab(p_point); } }; collisionFront.onTrigger += delegate (GameObject p_player) { if (!_grabing && !_inRasanteAttack && !_inSpitAttack && !_isDead && !_inAntecipation) { _player = p_player; int __rnd = Random.Range(1, 2); if (__rnd > 1) { if (!_inSpitAttack && !_isDead) { _anim.SetTrigger(_animSpit); _inSpitAttack = true; } } else { if (!_inRasanteAttack && !_isDead) { Antecipation(); //RasanteAttack(true); _inRasanteAttack = true; } } } _currentArea = collisionFront.positionType; }; collisionFront.onExitArea += delegate { if (_currentArea == MonsterCollisionManager.type.FRONT) _currentArea = MonsterCollisionManager.type.AWAY; }; collisionAround.onTrigger += delegate (GameObject p_player) { _player = p_player; if (!_inRoarAttack && !_isDead) { _anim.SetTrigger(_animRoar); _inRoarAttack = true; } PlayerOnMonsterZone(true); _currentArea = collisionAround.positionType; }; collisionAround.onExitArea += delegate { PlayerOnMonsterZone(false); if (_currentArea == MonsterCollisionManager.type.AROUND) _currentArea = MonsterCollisionManager.type.AWAY; //StartCoroutine(GoToAnimation(timeBetweenAttacks, "Walk")); if (!_inRasanteAttack) _player = null; }; this.enabled = true; spit.ManualStart(); Invoke("MoveToRandom", idleTime); }
void Start() { UnityEngine.Cursor.visible = false; _gameInfo = GameObject.Find("_info").GetComponent<Info>(); _audioSource = GetComponent<AudioSource>(); _currentPLayer = Instantiate(aircrafts[(int)_gameInfo.selectedAircraft], startPosition.position, Quaternion.identity) as GameObject; _currentPLayerCS = _currentPLayer.GetComponent<AirCraft>(); for (int i = 0; i< 50; i++) { _bulletsGO.Add(Instantiate(bulletPrefab, new Vector3(-1000, -1000, -1000), Quaternion.identity) as GameObject); } for (int i = 0; i < _bulletsGO.Count; i++) { int __num = i; _bullets.Add(_bulletsGO[__num].GetComponent<Bullet>()); _bullets[__num].gameObject.transform.parent = bulletsParent.transform; _bullets[__num].isActive = false; _bullets[__num].ManualStart(); } for (int i = 0; i < 30; i++) { _monsterLittleGO.Add(Instantiate(littleMonsterPrefab, new Vector3(-1000, -1000, -1000), Quaternion.identity) as GameObject); } for (int i = 0; i < _monsterLittleGO.Count; i++) { int __num = i; _monsterLittle.Add(_monsterLittleGO[__num].GetComponent<Monster>()); //_monsterLittle[__num].gameObject.transform.parent = monsterParent.transform; _monsterLittle[__num].onDisable += delegate { _monsterCount--; _monsterLittleUsed.Remove(_monsterLittle[__num]); _monsterLittleFree.Add(_monsterLittle[__num]); }; _monsterLittleFree.Add(_monsterLittle[__num]); _monsterLittle[__num].isActive = false; _monsterLittle[__num].enabled = false; _monsterLittle[__num].ManualStart(_currentPLayerCS); } _currentPLayerCS.soundController.monsterSound = monsterSource; _currentPLayerCS.ManualStart(_bullets, InstPanel, guiManager, aimHUD, _audioSource, levelMusic); currentMonster.onEnergyChange += delegate (float p_energy) { guiManager.ChangeValue("monsterEnergy", p_energy); }; currentMonster.onPlayerEnterMonsterZone += delegate { for (int i = 0; i < _monsterLittle.Count; i++) { int __num = i; if (_monsterLittle[__num].isActive) { if (_monsterLittle[__num].inPatrol) { _monsterLittle[__num].InvokeGoHome(); } else { _monsterLittle[__num].FollowPlayer(_currentPLayer); } } } }; currentMonster.onPlayerExitMonsterZone += delegate { for (int i = 0; i < _monsterLittle.Count; i++) { int __num = i; if (_monsterLittle[__num].isActive) { if (_monsterLittle[__num].inPatrol) { _monsterLittle[__num].FollowPlayer(_currentPLayer); } } } }; currentMonster.eventOne += delegate { completedEvents[0] = true; _currentMonsterRelease = 7; currentMonster.timeBetweenAttacks -= 5; currentMonster.idleTime -= 5; }; currentMonster.eventTwo += delegate { completedEvents[1] = true; _currentMonsterRelease = 10; currentMonster.timeBetweenAttacks -= 5; currentMonster.idleTime -= 5; }; guiManager.inGame = true; _currentPLayerCS.TPSCameraController.monster = currentMonster.gameObject; _currentPLayerCS.FPSCameraController.monster = currentMonster.gameObject; currentMonster.ManualStart(_currentPLayerCS); guiManager.monsterEnergy.maxValue = currentMonster.energy; guiManager.monsterEnergy.value = currentMonster.energy; guiManager.goToMenu += delegate { Destroy(_gameInfo); }; StartCoroutine(ReleaseMonsters(timeToSpawnLittleMonsters)); if (currentMonster.type == Monster.monsterType.AERIAL) { currentMonster.islands = spawnPoints; } }
public static string Move(AirCraft a) { return(string.Format("Sending cargo with aircraft: {0}", a.Title)); }