public void MeteoriteTest() { Meteorite meteorite; meteorite = new Meteorite((string)null, 0, 0, (string)null, (string)null, default(DateTime), 0, 0); Assert.IsNotNull((object)meteorite); Assert.AreEqual <string>((string)null, meteorite.Name); Assert.AreEqual <int>(0, meteorite.Id); Assert.AreEqual <int>(0, meteorite.Mass); Assert.AreEqual <string>((string)null, meteorite.Reclass); Assert.AreEqual <string>((string)null, meteorite.Fall); Assert.AreEqual <int>(1, meteorite.Date.Day); Assert.AreEqual <DayOfWeek>(DayOfWeek.Monday, meteorite.Date.DayOfWeek); Assert.AreEqual <int>(1, meteorite.Date.DayOfYear); Assert.AreEqual <int>(0, meteorite.Date.Hour); Assert.AreEqual <DateTimeKind>(DateTimeKind.Unspecified, meteorite.Date.Kind); Assert.AreEqual <int>(0, meteorite.Date.Millisecond); Assert.AreEqual <int>(0, meteorite.Date.Minute); Assert.AreEqual <int>(1, meteorite.Date.Month); Assert.AreEqual <int>(0, meteorite.Date.Second); Assert.AreEqual <int>(1, meteorite.Date.Year); Assert.AreEqual <double>(0, meteorite.RectLat); Assert.AreEqual <double>(0, meteorite.RectLong); }
// Switches the ItemSource of the AnnoDataGrid when a filtering option is selected private void AnnoCombo_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (AnnoCombo.SelectedItem == AllAnno) { Annotation context = new Annotation(); annoCollection = annoDB.AnnoCol; AnnoDataGrid.DataContext = annoDB; AnnoDataGrid.ItemsSource = annoCollection; AnnoDataGrid.Items.Refresh(); changeButtonText(context); } else if (AnnoCombo.SelectedItem == MeteoFilteredAnno) { // Sets ItemsSource to List associated with Meteorite in AnnoLib // Requires object from Meteor Selection to search annoLib // Throws null object, so don't use it for now. Meteorite context = new Meteorite(); annoCollection = libDB.collection; AnnoDataGrid.DataContext = libDB; AnnoDataGrid.ItemsSource = annoCollection; AnnoDataGrid.Items.Refresh(); changeButtonText(context); } }
public void Seek(Transform _target) { target = _target; switch (_target.gameObject.transform.parent.gameObject.tag) { case "Meteorite": { meteoriteComponent = _target.gameObject.transform.parent.gameObject.GetComponent <Meteorite>(); targetMoveSpeed = meteoriteComponent.speed; enemyType = "Meteorite"; break; } case "SmallAlien": { smallAlienComponent = _target.gameObject.transform.parent.gameObject.GetComponent <SmallAlien>(); targetMoveSpeed = smallAlienComponent.speed; enemyType = "SmallAlien"; break; } case "MediumAlien": { mediumAlienComponent = _target.gameObject.transform.parent.gameObject.GetComponent <MediumAlien>(); targetMoveSpeed = mediumAlienComponent.speed; enemyType = "MediumAlien"; break; } case "BossAlien": { bossAlienComponent = _target.gameObject.transform.parent.gameObject.GetComponent <BossAlien>(); targetMoveSpeed = bossAlienComponent.speed; enemyType = "BossAlien"; break; } } }
private void CreateMeteorite(Meteorite meteorite, Vector3 position) { float timeToFall = Random.Range(meteorite.BoomTimeMin, meteorite.BoomTimeMax + 1); /// значения в интах, поэтому +1 чтобы в инспекторе проще было int addSecondsToBoom = 6; /// перестраховка от бага, что иногда не определяется положения игрока foreach (var e in CellController.CellDouble) { if (e.currentState == Cell.State.PlayerOcupied) { //Debug.Log(e.name); float x = Mathf.Abs(e.transform.position.x - position.x); float z = Mathf.Abs(e.transform.position.z - position.z); addSecondsToBoom = Mathf.RoundToInt((x + z) * NewPlayerController.TimeToReachNextTile) + 1; break; //Debug.LogError($"спавним метеорит № {meteoriteCounter + 1}"); } } GameObject newMeteorite = GameObject.Instantiate(Resources.Load(MeteoriteTarget.name), position, Quaternion.Euler(0f, 0f, 0f)) as GameObject; //_meteoriteOcupiedPositions[_meteoriteCounter] = position; //_meteoriteCounter++; //if (_meteoriteCounter > _meteoriteOcupiedPositions.Length - 1) // _meteoriteCounter = 0; newMeteorite.GetComponent <DestroyMeteoritTimer>().timetoFall = timeToFall + addSecondsToBoom; meteoriteCounter++; State = States.Ready; //Debug.Log($"addSecondsToBoom = {timeToFall} + {addSecondsToBoom}" ); }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.CompareTag("Meteorite")) { Meteorite meteorite = collision.gameObject.GetComponent <Meteorite>(); if (meteorite != null) { FindObjectOfType <Score>().AddPoints(10); meteorite.DestroyMeteorite(); GameObject particles = Instantiate(hitParticlesPrefab, transform.position, transform.rotation); Destroy(particles, 5f); Destroy(this.gameObject); } } if (collision.gameObject.CompareTag("Enemy")) { Enemy enemy = collision.gameObject.GetComponent <Enemy>(); if (enemy != null) { FindObjectOfType <Score>().AddPoints(20); enemy.Damage(damageAmount); GameObject particles = Instantiate(hitParticlesPrefab, transform.position, transform.rotation); Destroy(particles, 5f); Destroy(this.gameObject); } } }
private void MouseMineMinerals() { Vector3 mouseWorldPos = Camera.main.ScreenToWorldPoint(Input.mousePosition); Debug.DrawLine(transform.position, mouseWorldPos, Color.yellow); if (Vector2.Distance(mouseWorldPos, transform.position) < radius) { Collider2D meteoriteCollider = Physics2D.OverlapPoint(mouseWorldPos, LayerMask.GetMask("Mineable")); if (meteoriteCollider != null) { Debug.DrawRay(transform.position, meteoriteCollider.transform.position - transform.position, Color.red, 1.0f); var mineralParticle = Instantiate(mineralParticlePrefab, meteoriteCollider.transform.position, Quaternion.identity); mineralParticle.MoveTowards(transform); Meteorite meteorite = meteoriteCollider.GetComponent <Meteorite>(); Managers.PlayerResources.minerals += meteorite.Mine(speed); } } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.CompareTag("Meteorite")) { Meteorite meteorite = collision.gameObject.GetComponent <Meteorite>(); if (meteorite != null) { Destroy(collision.gameObject); Destroy(this.gameObject); } } if (collision.gameObject.CompareTag("Player")) { Player player = collision.gameObject.GetComponent <Player>(); if (player != null) { player.Damage(damageAmount); Destroy(this.gameObject); } } }
public LibObject(Meteorite m, string s) { meteoID = m.Id; meteoString = s; annoColl = new ObservableCollection <Annotation>(); //stringListLocation = annoLib.getDictionaryPosition(meteo); }
// Simply copies the List at the meteorite, adds the new annotation, and makes a new list public void appendAnno(Meteorite m, Annotation a) { ObservableCollection <Annotation> newList = returnAnnoList(m); newList.Add(a); meteoDictionary[m] = newList; }
public void gatherMeteoData(Meteorite meteo) { annoCollection = annoLib.returnAnnoList(meteo); currMeteo = meteo; AnnoDataGrid.DataContext = libDB; AnnoDataGrid.ItemsSource = annoCollection; changeButtonText(meteo); }
public override RainDrop CreateOffensiveRainDrop() { // meteorite image BitmapImage img = new BitmapImage(new Uri(BaseUriHelper.GetBaseUri(Application.Current.MainWindow), "../Images/meteorite.png")); Meteorite meteorite = new Meteorite(img); return(meteorite); }
public override void StateUpdate() { Meteorite.FallDown(); if (Meteorite.TransformRoot.position.y <= -100f) { Meteorite.gameObject.SetActive(false); } }
public void createMeteorite() { Vector3 sizeCamera = cameraFeild.GetComponent <SpriteRenderer>().bounds.size; Vector3 cameraPos = feildPosition.transform.position + new Vector3(-sizeCamera.x / 2, sizeCamera.y / 2); int side = Random.Range(0, 4); float offsetPosX = 0; float offsetPosY = 0; if (side == 0) //Вверх { offsetPosX = Random.Range(0, sizeCamera.x); offsetPosY = Random.Range(offsetBorder / k, offsetBorder); } else if (side == 1) //Право { offsetPosX = Random.Range(sizeCamera.x + offsetBorder / k, sizeCamera.x + offsetBorder); offsetPosY = Random.Range(-sizeCamera.y, 0); } else if (side == 2) //Низ { offsetPosX = Random.Range(0, sizeCamera.x); offsetPosY = Random.Range(-sizeCamera.y - offsetBorder, -sizeCamera.y - (offsetBorder / k)); } else if (side == 3) //Лево { offsetPosX = Random.Range(-offsetBorder, -offsetBorder / k); offsetPosY = Random.Range(-sizeCamera.y, 0); } Vector3 meteoritePos = cameraPos + new Vector3(offsetPosX, offsetPosY); meteoritePos = new Vector3(meteoritePos.x, meteoritePos.y, 0); int prifabId = Random.Range(0, prifab.Length); GameObject obj = prifab[prifabId]; meteorite.Add(Instantiate(obj, meteoritePos, new Quaternion(0, 0, Random.Range(0, 360), 0))); int countCreatedMeteorite = meteorite.Count - 1; Meteorite meteoriteComponent = meteorite[countCreatedMeteorite].GetComponent <Meteorite>(); float speedMeteorite = Random.Range(meteoriteComponent.minSpeed, meteoriteComponent.maxSpeed); Vector3 mPos = new Vector3(meteorite[countCreatedMeteorite].transform.position.x, meteorite[countCreatedMeteorite].transform.position.y, 0); Vector3 pointInFeild = cameraPos + new Vector3(Random.Range(0, sizeCamera.x), -Random.Range(0, sizeCamera.y), 0); Vector3 direction = (pointInFeild - mPos).normalized; meteorite[countCreatedMeteorite].GetComponent <Rigidbody2D>().velocity = direction * speedMeteorite; countCreatedMeteorite++; countLoadingMeteorite--; if (countCreatedMeteorite >= countMeteorite) { countCreatedMeteorite = 0; } }
private void CheckAmountMeteorite(Meteorite e) { meteos.Remove(e); e.OnDead -= CheckAmountMeteorite; if (meteos.Count == 0 && !spawning) { PlayerController.PlayerCurrent.LocKDirectFire = false; EndRound(); } }
public void unappendAnno(Meteorite m, Annotation a) { ObservableCollection <Annotation> newList = returnAnnoList(m); if (newList.Contains(a)) { newList.Remove(a); } meteoDictionary[m] = newList; }
public override void StateUpdate() { Meteorite.FallDown(); if (Meteorite.CheckGround()) { Meteorite.SetState(eMeteoriteState.StuckGround); Meteorite.SpawnHole(); GameEventManager.Instance.OnMeteoriteFall(); } }
private void OnTriggerEnter2D(Collider2D collision) { Meteorite meteorite = collision.GetComponent <Meteorite>(); if (meteorite != null) { meteorite.life -= 1; Destroy(gameObject); } }
private void OnTriggerEnter(Collider other) { if (!other.gameObject.CompareTag("Robot")) return; //other.gameObject.GetComponent<RobotSound>().PlayMajorSound(RobotSound.MajorSoundType.Scared); //spawn meteorite Debug.Log("boom"); meteorite = (Instantiate(meteoritePrefab, meteoriteSpawnPos, Quaternion.identity)) as Meteorite; meteorite.onHit += OnMeteoriteHit; meteorite.m_bluryPlate = Instantiate(blurryPlatePrefab,player.transform.position + Vector3.forward * 0.4f, Quaternion.identity) as GameObject; }
public bool has(Meteorite m) { if (meteoDictionary.ContainsKey(m)) { return(true); } else { return(false); } }
public int findListLength(Meteorite m) { if (meteoDictionary.ContainsKey(m)) { return(meteoDictionary[m].Count); } else { return(0); } }
public void addToLib(Meteorite m, Annotation a) { string anno = a.getAnno(); string annoString = "\n" + anno + "\n"; LibObject lbo = new LibObject(m, anno); library.appendAnno(m, a); LibTable.InsertOnSubmit(lbo); collection.Add(a); SubmitChanges(); }
private void OnCollisionEnter2D(Collision2D collision) { Meteorite meteorite = collision.gameObject.GetComponent <Meteorite>(); //Debug.Log(collision.gameObject.name); if (meteorite != null && timeCount1 <= 0) { TakeDamage(damage); timeCount1 = frecuency; } }
void Die() { player.points += (level + player.life) * 5; if (level > 1) { gameObject.transform.localScale = new Vector3(5, 5, 1); Meteorite go1 = Instantiate(meteoritePrefab, transform.position + Vector3.right * 0.5f, Quaternion.Euler(0, 0, Random.Range(0f, 360f))); go1.level = level - 1; Meteorite go2 = Instantiate(meteoritePrefab, transform.position + Vector3.left * 0.5f, Quaternion.Euler(0, 0, Random.Range(0f, 360f))); go2.level = level - 1; } Destroy(gameObject); }
private void OnTriggerEnter(Collider other) { if (!other.gameObject.CompareTag("Robot")) { return; } //other.gameObject.GetComponent<RobotSound>().PlayMajorSound(RobotSound.MajorSoundType.Scared); //spawn meteorite Debug.Log("boom"); meteorite = (Instantiate(meteoritePrefab, meteoriteSpawnPos, Quaternion.identity)) as Meteorite; meteorite.onHit += OnMeteoriteHit; meteorite.m_bluryPlate = Instantiate(blurryPlatePrefab, player.transform.position + Vector3.forward * 0.4f, Quaternion.identity) as GameObject; }
private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.CompareTag("Meteorite")) { Meteorite meteorite = collision.gameObject.GetComponent <Meteorite>(); if (meteorite != null) { FindObjectOfType <Score>().AddPoints(10); Destroy(collision.gameObject); Destroy(this.gameObject); } } }
public Meteorite SpawnMeteorite(Vector3 position, Quaternion rotation) // Grab a meteorite from the object pool and activate it with the given position and rotation { if (meteoritePool.Count < 1) { return(null); } Meteorite meteorite = meteoritePool.Dequeue(); meteorite.transform.position = position; meteorite.transform.rotation = rotation; meteorite.gameObject.SetActiveRecursively(true); return(meteorite); }
protected override void Awake() { base.Awake(); if (Prefab == null) { Prefab = Resources.Load <Meteorite>(Path); if (Prefab != null) { idMeteo = pool.AddPrefab(Prefab); } else { Debug.Log("Không tìm thấy Thiện thạch"); } } }
public void delLib(Meteorite m, Annotation a) { Annotation victim = a; int victimID = victim.ID; var deleteRow = from libs in LibTable where libs.meteoID == victimID select libs; foreach (var lib in deleteRow) { LibTable.DeleteOnSubmit(lib); } collection.Remove(a); SubmitChanges(); }
//FUN_250 (ROUTE66.DLL) public override uint UpdateW(int arg1, int arg2) { VigTuple ppiVar2; Meteorite puVar3; List <VigTuple> ppiVar4; VigObject oVar5; VigObject oVar6; int iVar7; switch (arg1) { case 1: GameManager.instance.offsetFactor = 2.5f; GameManager.instance.offsetStart = 0; GameManager.instance.angleOffset = 0.4f; GameManager.instance.DAT_1000 |= 1; GameObject obj = new GameObject(); DAT_5304 = obj.AddComponent <Meteorite>(); DAT_5304.id = 0; GameManager.instance.FUN_30CB0(DAT_5304, 900); oVar5 = GameManager.instance.FUN_30250(GameManager.instance.DAT_1078, 0x100); oVar6 = GameManager.instance.FUN_4AC1C(0xfe000000, oVar5); GameManager.instance.DAT_1038 = oVar6 != null ? 1 : 0; ppiVar4 = GameManager.instance.DAT_1078; for (int i = 0; i < ppiVar4.Count; i++) { ppiVar2 = ppiVar4[i]; oVar6 = ppiVar2.vObject; if ((uint)(ushort)oVar6.id - 400 < 13) { iVar7 = (ushort)oVar6.id - 400; DAT_5268[iVar7] = oVar6.screen; } } goto case 2; case 2: GameManager.instance.FUN_34B34(); GameManager.instance.FUN_30CB0(this, 240); break; } return(0); }
IEnumerator SpawnMeteorites(Vector2 Node1, Vector2 Node2, Vector2 Direction, bool isVer, Vector3 posZone, Vector2 posColliderEnd, Vector2 sizeColliderEnd) { yield return(new WaitForSeconds(3f)); if (colliderEnd != null) { colliderEnd.gameObject.SetActive(true); colliderEnd.transform.position = posColliderEnd; colliderEnd.size = sizeColliderEnd; } CameraMove.Instance.AddPosition(new TaretVector3("Round Hail", ((Vector2)posZone + Data.position) / 2)); PlayerController.PlayerCurrent.DirectFire = -Direction; PlayerController.PlayerCurrent.LocKDirectFire = true; WaveHail waveCurrent = Data.WavesHail[idcurrent]; float timeSpawned = 0; float timeWait = 0; float AmountPerSecond = waveCurrent.Density * (isVer ? Data.Size.x : Data.Size.y); float timeDelayPerMeteorite = 1 / AmountPerSecond; if (timeDelayPerMeteorite == 0) { Debug.Log("Timedelay = 0 nen fix lai 0.1f"); timeDelayPerMeteorite = 0.1f; } spawning = true; while (timeSpawned < waveCurrent.Time) { yield return(null); timeSpawned += Time.deltaTime; timeWait += Time.deltaTime; while (timeWait > timeDelayPerMeteorite) { Vector2 pos = GetRandomPositionInLine(Node1, Node2); Meteorite a = pool.Spawn(idMeteo, pos, MathQ.DirectionToQuaternion(Direction)) as Meteorite; a.StartUp(waveCurrent.Speed, Direction, Random.Range(waveCurrent.RangeHp.x, waveCurrent.RangeHp.y)); meteos.Add(a); a.OnDead += CheckAmountMeteorite; timeWait -= timeDelayPerMeteorite; } } if (zoneSpawn != null) { zoneSpawn.gameObject.SetActive(false); } spawning = false; }
public Meteorite ConstructorTest( string tname, int tid, int tmass, string treclass, string tfall, DateTime tdate, double tlat, double tlong ) { Meteorite target = new Meteorite(tname, tid, tmass, treclass, tfall, tdate, tlat, tlong); return(target); // TODO: add assertions to method MeteoriteTest.ConstructorTest(String, Int32, Int32, String, String, DateTime, Double, Double) }
// Disable the given meteorite and move it back into the object pool public void DespawnMeteorite(Meteorite meteorite) { meteorite.gameObject.SetActiveRecursively (false); meteoritePool.Enqueue (meteorite); }