public Game(Vector2D spawnPos1, Vector2D spawnPos2) { var damageDice = new Texture("Resource/DamageDice.png"); var spawnData = new[] { new Rectangle(spawnPos1, 32, 32), new Rectangle(spawnPos2, 32, 32) }; var colors = new[] { Palette.White, Palette.Green }; for (int i = 0; i < 2; i++) { var diceList = Texture.LoadDivision($"Resource/DiceList{i + 1}.png", 5, 1).ToList(); diceList.Add(damageDice); players[i] = new DicePlayer(spawnData[i], diceList, colors[i]); } item = new BulletItem(gameField); Data.MainMusic.Play(PlayType.Loop); }
public GameObject CreateBullet(int id, Transform page) { GameObject bullet = Instantiate(_BulletItemPrefab, page); BulletItem item = bullet.GetComponent <BulletItem>(); item.bulletInfo = new BulletInfo(id); return(bullet); }
public void AddItemSlot(BulletItem item) { _bItem = item; _itemCount = item._value; _itemIcon.sprite = item._image; _textCount.text = _itemCount.ToString(); SetColor(1); }
public void OnDrop(PointerEventData eventData) { BulletItem item = eventData.pointerDrag.GetComponent <BulletItem>(); if (item != null) { _BulletsDeck.SetBulletInfo(idx, item.bulletInfo.ID); } }
public void AddProjectile(BulletItem item, int count) { _projectileDates[(int)item._bulletType]._value += count; // 인벤토리 UI 데이터와 변화 if (_player._gunController._equipedGun._bulletType == item._bulletType) { UIMng.Instance.CallEvent(UIList.HUD, "UpdateRemainAmmo", item._bulletType); } }
private void Fire() { int tot = instantiatePoint.Length; for (int i = 0; i < tot; i++) { //Instantiate(currentBullet.prefab, instantiatePoint[i].position, instantiatePoint[i].rotation) BulletItem temp = GameController.Instance.InstantiateEntity(currentBullet.prefab, instantiatePoint[i].position, instantiatePoint[i].rotation) as BulletItem; temp.Initialize(instantiatePoint[i].forward); } }
//ボタンを押したらセット。 public void SetBulletInfoFromButton(BulletItem button) { //空いているところを探す。 int idx = 0; foreach (int id in Data.Deck.bullets) { //空か? if (id < 0) { //情報セット。 SetBulletInfo(idx, button.bulletInfo.ID); break; } idx++; } }
/// <summary> /// Kontruktor der Klasse Game, nimmt die SpaceInvaderForm entgegen /// </summary> /// <param name="container"></param> public Game(SpaceInvadersForm container) { _container = container; _gameTimer = new Timer(); _gameTimer.Interval = 1; _gameTimer.Tick += Play; _rocks = new Rocks(this); _ship = new SpaceShip(this); _infobar = new Infobar(this); _invaders = new Invaders(this); _bulletItem = new BulletItem(this); _movespeedItem = new MovespeedItem(this); _itemWatch = new Stopwatch(); }
/// <summary> /// 读取表数据,生成对应的数组 /// </summary> /// <param name="filePath">excel文件全路径</param> /// <returns>Item数组</returns> public static BulletItem[] CreateBulletItemArrayWithExcel(string filePath) { //获得表数据 int columnNum = 0, rowNum = 0; DataRowCollection collect = ReadExcel(filePath, ref columnNum, ref rowNum); //根据excel的定义,第二行开始才是数据 BulletItem[] array = new BulletItem[rowNum - 1]; for (int i = 1; i < rowNum; i++) { BulletItem item = new BulletItem(); //解析每列的数据 item.TypeID = int.Parse(collect[i][0].ToString()); item.ModePath = collect[i][1].ToString(); item.Level = int.Parse(collect[i][2].ToString()); array[i - 1] = item; } return(array); }
//protected BulletItemManager m_BIM = Resources.Load<BulletItemManager>("Conf/BulletItem"); //获取子弹模型路径 public string GetBulletModePath(string paths) { Debug.Log("GetBulletModePath:" + paths); if (paths.Length <= 0) { return(""); } string[] arr1 = paths.Split(','); BulletItem modeitem = null; foreach (var item in arr1) { var bulletitem = ExcelManager.Instance.GetBulletIM().GetBIByID(int.Parse(item)); if (bulletitem != null) { if (modeitem == null) { modeitem = bulletitem; } else { if (bulletitem.Level >= modeitem.Level) { modeitem = bulletitem; } } } } if (modeitem == null) { return(""); } else { return(modeitem.ModePath); } }
public override void OnUpdate() { if (!MusicManager.Instance.IsPlaying()) { _iCtrl.Close(); return; } LinkedListNode <BulletItem> temp = m_BulletObjs.First; while (temp != null) { BulletState bulletState = BulletState.Normal; BulletItem item = temp.Value; MusicEventData musicData = item.musicData; float bulletCollisionX1 = item.obj.transform.position.x; // - item.collisionSize.x * 0.5f; if (bulletCollisionX1 <= m_Player.transform.position.x) { bulletState = BulletState.Dead; } else { //进入外圈 if (bulletCollisionX1 <= m_OutTargetX2 && bulletCollisionX1 >= m_OutTargetX1) { bulletState = BulletState.IntoOut; if (bulletCollisionX1 <= m_InnerTargetX2 && bulletCollisionX1 >= m_InnerTargetX1) { bulletState = BulletState.IntoInner; } } } //Debug.Log(bulletState); switch (bulletState) { case BulletState.Dead: m_BulletObjs.Remove(temp); GameObject.Destroy(item.obj); break; case BulletState.Normal: switch (musicData.oper) { case MusicOper.LongUp: if (LTInput.GetKey(KeyCode2.Left)) { if (item.collisionPoint != Vector3.zero) { float offset = item.collisionPoint.x - bulletCollisionX1; item.maskTrans.sizeDelta = new Vector2(item.maskSize.x - offset, item.maskTrans.sizeDelta.y); } } break; case MusicOper.LongDown: if (LTInput.GetKey(KeyCode2.Right)) { if (item.collisionPoint != Vector3.zero) { float offset = Mathf.Abs(item.collisionPoint.x - bulletCollisionX1); item.maskTrans.sizeDelta = new Vector2(item.maskSize.x - offset, item.maskTrans.sizeDelta.y); } } break; } break; case BulletState.IntoOut: case BulletState.IntoInner: { switch (musicData.oper) { case MusicOper.Up: if (LTInput.GetKeyDown(KeyCode2.Left)) { m_BulletObjs.Remove(temp); GameObject.Destroy(item.obj); } break; case MusicOper.LongUp: if (LTInput.GetKey(KeyCode2.Left)) { if (item.collisionPoint == Vector3.zero) { item.collisionPoint = new Vector3(bulletCollisionX1, 0, 0); } float offset = item.collisionPoint.x - bulletCollisionX1; item.maskTrans.sizeDelta = new Vector2(item.maskSize.x - offset, item.maskTrans.sizeDelta.y); } break; case MusicOper.Down: if (LTInput.GetKeyDown(KeyCode2.Right)) { m_BulletObjs.Remove(temp); GameObject.Destroy(item.obj); } break; case MusicOper.LongDown: if (LTInput.GetKey(KeyCode2.Right)) { if (item.collisionPoint == Vector3.zero) { item.collisionPoint = new Vector3(bulletCollisionX1, 0, 0); } float offset = Mathf.Abs(item.collisionPoint.x - bulletCollisionX1); item.maskTrans.sizeDelta = new Vector2(item.maskSize.x - offset, item.maskTrans.sizeDelta.y); } break; } } break; } temp = temp.Next; } }
//bool isCreate = false; void OnEventChangeHandler(MusicEventData data) { //if (!isCreate) //{ // data.oper = MusicOper.LongUp; // isCreate = true; //} //else //{ // return; //} GameObject bulletObj = GameObject.Instantiate(m_Bullet); bulletObj.Attach(m_Bullets); bulletObj.transform.position = m_Enermy.transform.position; bulletObj.SetActive(true); bulletObj.transform.DOMoveX(m_Player.transform.position.x, m_Speed).SetEase(Ease.Linear); BulletItem item = new BulletItem(); item.obj = bulletObj; item.bgImage = bulletObj.transform.Find("bg").GetComponent <Image>(); item.contentText = bulletObj.transform.Find("bg/Text").GetComponent <Text>(); item.maskTrans = bulletObj.transform.Find("bg").GetComponent <RectTransform>(); item.musicData = data; item.collisionSize = bulletObj.GetComponent <RectTransform>().sizeDelta; switch (data.oper) { case MusicOper.Up: item.outScore = 100; item.innerScore = 150; item.bgImage.color = m_upColor; break; case MusicOper.LongUp: item.outScore = 200; item.innerScore = 300; item.bgImage.color = m_longUpColor; break; case MusicOper.Down: item.outScore = 100; item.innerScore = 150; item.bgImage.color = m_downColor; break; case MusicOper.LongDown: item.outScore = 200; item.innerScore = 300; item.bgImage.color = m_longDownColor; break; } item.contentText.text = data.content; float width = item.contentText.TextWidth(); if (data.sampleLen > 0) { if (data.sampleLen * m_OneSmapleLength > width) { width = data.sampleLen * m_OneSmapleLength; } } item.maskSize = new Vector2(width, 0); item.bgImage.GetComponent <RectTransform>().offsetMax = new Vector2(width, 0); item.bgImage.GetComponent <RectTransform>().sizeDelta = new Vector2(width, 36); m_BulletObjs.AddLast(item); }
void itemInit() { _hero.iBood = 5; _hero.iMoveSpeed = 210f; _data.jqName = "level1JQ"; FruitData fd = new FruitData(); fd.name = "order1"; fd.interval = 0.4f; fd.minGet = 7; FruitItem fi = new FruitItem(); fi.name = "fruit1"; fi.weight = 1; fi.speed = 100; for(int i = 0; i < 11; ++i) fd.fruits.Add(fi); _data.fruit = fd; EnemyData ed = new EnemyData(); ed.iBoold = 8; ed.moveSpeed = 160; ed.interval = 1f; ed.iBulCount = 12; for (int i = 0; i < ed.iBulCount; ++i) { BulletItem bd = new BulletItem(); int range = Random.Range(0, 2); bd.bCanRebound = range == 0 ? false : true; bd.weight = 1; bd.speed = 100; ed.bullets.Add(bd); } _data.enemy = ed; }