void Start() { //collisionCollider = collisionObj.GetComponent<EventTrigger>(); //exitTrigger = ExitObj.GetComponent<EventTrigger>(); bombDamage = PowerUpManager.GetBombDamage; bombRadius = PowerUpManager.GetBombRadius; type = PowerUpManager.BombType; isLaunched = transform.root == transform; if (isLaunched && type != BombType.Timer) { GameObject spark = GetComponentInChildren <ParticleSystem>().gameObject; Destroy(spark); } // If the bomb has no parent, it has been laid by the player and should detonate. if (isLaunched) { //bombのScaleが0.18f exitTrigger.gameObject.GetComponent <CircleCollider2D>().radius = bombRadius * 5f - 1f; StartCoroutine(BombDetonation()); } }
void CreateBombByType(BombType bombType) { _binBomb = (GameObject)Instantiate((GameObject)_bombsTypeHash[bombType], transform.position - new Vector3(0, 0, 1), Quaternion.identity); _binBomb.transform.parent = transform; _binBomb.GetComponent <BombManager>()._ScoreManager = _ScoreManager; _binBomb.GetComponent <BombManager>()._LifeManager = _LifeManager; }
public static void RemoveBomb(Unit _Bomb, BombType _Type) { switch (_Type) { case BombType.Stasis: StasisBomb stasisBomb = Config._StasisBombs.FirstOrDefault <StasisBomb>((Func <StasisBomb, bool>)(x => (Entity)x._Unit == (Entity)_Bomb)); if (stasisBomb == null) { break; } if (Config._ParticleManager.HasParticle(stasisBomb._Unit.Handle.ToString())) { Config._ParticleManager.Remove(stasisBomb._Unit.Handle.ToString()); } IParticleManager particleManager1 = Config._ParticleManager; string str1 = "st"; uint handle = stasisBomb._Unit.Handle; string str2 = handle.ToString(); string name1 = str1 + str2; if (particleManager1.HasParticle(name1)) { IParticleManager particleManager2 = Config._ParticleManager; string str3 = "st"; handle = stasisBomb._Unit.Handle; string str4 = handle.ToString(); string name2 = str3 + str4; particleManager2.Remove(name2); } Config._StasisBombs.Remove(stasisBomb); break; case BombType.Land: LandBomb landBomb = Config._LandBombs.FirstOrDefault <LandBomb>((Func <LandBomb, bool>)(x => (Entity)x._Unit == (Entity)_Bomb)); if (landBomb == null) { break; } if (Config._ParticleManager.HasParticle(landBomb._Unit.Handle.ToString())) { Config._ParticleManager.Remove(landBomb._Unit.Handle.ToString()); } Config._LandBombs.Remove(landBomb); BombManager.ReBindLandStacker(_Bomb); break; case BombType.Remote: RemoteBomb remoteBomb = Config._RemoteBombs.FirstOrDefault <RemoteBomb>((Func <RemoteBomb, bool>)(x => (Entity)x._Unit == (Entity)_Bomb)); if (remoteBomb == null) { break; } if (Config._ParticleManager.HasParticle(remoteBomb._Unit.Handle.ToString())) { Config._ParticleManager.Remove(remoteBomb._Unit.Handle.ToString()); } Config._RemoteBombs.Remove(remoteBomb); BombManager.ReBindStacker(_Bomb); break; } }
private Bomb CreateBomb(BombType type) { Bomb pBomb = null; switch (type) { case BombType.Straight: pBomb = new Bomb(GameObject.Name.BombStraight, GameSprite.Name.BombStraight, 0.0f, 0.0f); break; case BombType.ZigZag: pBomb = new Bomb(GameObject.Name.BombZigZag, GameSprite.Name.BombZigZag, 0.0f, 0.0f); break; case BombType.Cross: pBomb = new Bomb(GameObject.Name.BombCross, GameSprite.Name.BombCross, 0.0f, 0.0f); break; default: Debug.Assert(false); break; } Debug.Assert(pBomb != null); return(pBomb); }
static CommonReflectedTypeInfo() { BombType = ReflectionHelper.FindType("Bomb"); BombComponentsField = BombType.GetField("BombComponents", BindingFlags.Public | BindingFlags.Instance); HasDetonatedProperty = BombType.GetProperty("HasDetonated", BindingFlags.Public | BindingFlags.Instance); GetTimerMethod = BombType.GetMethod("GetTimer", BindingFlags.Public | BindingFlags.Instance); NumStrikesField = BombType.GetField("NumStrikes", BindingFlags.Public | BindingFlags.Instance); NumStrikesToLoseField = BombType.GetField("NumStrikesToLose", BindingFlags.Public | BindingFlags.Instance); BombComponentType = ReflectionHelper.FindType("BombComponent"); ComponentTypeField = BombComponentType.GetField("ComponentType", BindingFlags.Public | BindingFlags.Instance); ModuleDisplayNameField = BombComponentType.GetMethod("GetModuleDisplayName", BindingFlags.Public | BindingFlags.Instance); IsSolvedField = BombComponentType.GetField("IsSolved", BindingFlags.Public | BindingFlags.Instance); OnPassField = BombComponentType.GetField("OnPass", BindingFlags.Public | BindingFlags.Instance); OnStrikeField = BombComponentType.GetField("OnStrike", BindingFlags.Public | BindingFlags.Instance); HandlePassMethod = BombComponentType.GetMethod("HandlePass", BindingFlags.NonPublic | BindingFlags.Instance); TimerComponentType = ReflectionHelper.FindType("TimerComponent"); TimeRemainingField = TimerComponentType.GetField("TimeRemaining", BindingFlags.Public | BindingFlags.Instance); GetFormattedTimeMethod = TimerComponentType.GetMethod("GetFormattedTime", BindingFlags.Public | BindingFlags.Static); ResultPageType = ReflectionHelper.FindType("ResultPage"); PassEventType = ReflectionHelper.FindType("PassEvent"); StrikeEventType = ReflectionHelper.FindType("StrikeEvent"); BombBinderType = ReflectionHelper.FindType("BombBinder"); FreeplayDeviceType = ReflectionHelper.FindType("FreeplayDevice"); }
public void init(CellType _cellType,BombType _cellBombType,CellColor _cellColor) { string spritePath = _cellType.ToString() +_cellBombType.ToString()+ _cellColor.ToString(); Sprite newSprite = Resources.Load("Sprite/Cells/"+spritePath,typeof(Sprite)) as Sprite; GetComponent<SpriteRenderer>().sprite = newSprite; }
internal void GetBombStatus(GameObject invokingBomb, BombType messageID) { switch (messageID) { case BombType.disarmable: //wylaczono bombe bombPool.ReturnBombToPool(invokingBomb); break; case BombType.nonDisarmable: //bomba wybuchla lub tapnieto czarna //invokingBomb.SetActive(false); keepBombing = false; endTheGame.Invoke(); //callback do konca gry foreach (GameObject temp in ActiveBombs) { temp.GetComponent <Bomb>().detonationSpeedFactor = 5f; // tutaj mozna dodac ze szybciej bomby wybuchaja czy cos za pomoca detonateSpeedFactor } break; case BombType.dontTapExpired: // czarna bomba znika bombPool.ReturnBombToPool(invokingBomb); break; default: // jakas bomba wybucha po pregranej - nic nie trzeba robic break; } }
public void BuyBomb(BombType type) { if (Money < type.Price) return; Money -= type.Price; Game.BombSpawner.SpawnBomb (type); }
private void Start() { if (gameObject.tag == "Player") { SecondaryBomb = (BombType)Enum.Parse(typeof(BombType), PlayerPrefs.GetString("BombP1", "No"), true); } else if (gameObject.tag == "Player 2") { SecondaryBomb = (BombType)Enum.Parse(typeof(BombType), PlayerPrefs.GetString("BombP2", "No"), true); } BombeBaseScript bbs; switch (SecondaryBomb) { case BombType.Flash: bbs = this.FlashBomb.GetComponent <BombeBaseScript>(); SetMaxUse(bbs); break; case BombType.Mine: default: bbs = this.MineBomb.GetComponent <BombeBaseScript>(); SetMaxUse(bbs); break; } }
public void AddBomb(int _playerIndex = -1, float _bombTime = -1f) { print("AddBomb"); //RestartRound (); isBombInPlay = true; canPlaceBomb = false; List <int> playerIndexes = GetComponent <GameController>().GetPlayerIndexes(); int playerIndexToGetBomb = (_playerIndex == -1) ? Random.Range(0, playerIndexes.Count) : _playerIndex; PlayerController playerGetBomb = (_playerIndex == -1) ? players[playerIndexes[playerIndexToGetBomb]] : players[playerIndexToGetBomb]; playerGetBomb.GetComponent <PassTheBombPlayer>().ReceiveBomb(); GetComponent <GameController>().UIController.SetStatusText(playerGetBomb.playername + " har bomben!"); GameObject bomb = Instantiate(bombPrefab, bombStartPosition, Quaternion.identity); BombType bombType = bombTypes[Random.Range(0, bombTypes.Length)]; bomb.GetComponent <PassTheBombBomb>().bombTime = (_bombTime == -1) ? Random.Range(bombType.MinimumBombTime, bombType.MaximumBombTime) : _bombTime; bombsInPlay.Add(bomb); PlaceBomb(bomb, playerGetBomb.index); audioSource.clip = tickingBomb; audioSource.loop = true; audioSource.Play(); }
public Player(float posX, float posY, PlayerColour colour, PlayerDirection direction) { position = new PointF(posX, posY); UpdateHitbox(); playerColour = colour; playerDirection = direction; moving = false; maxBombs = 1; bombsLeft = maxBombs; moveSpeed = 1.0f; bombSize = 1; bombType = BombType.GRAY; falling = false; animationTick = 0; animationFrame = 0; animationFoot = false; keysDown = new bool[4] { false, false, false, false }; }
void CreateBombByType(BombType bombType) { _binBomb = (GameObject)Instantiate((GameObject)_bombsTypeHash[bombType], transform.position - new Vector3(0, 0, 1), Quaternion.identity); _binBomb.transform.parent = transform; _binBomb.GetComponent<BombManager>()._ScoreManager = _ScoreManager; _binBomb.GetComponent<BombManager>()._LifeManager = _LifeManager; }
void FixedUpdate() { bombsLeft = player.currentBombAmount; BombType btype = Player.instance.bombType; if (btype == BombType.Normal) { bombText.text = $"Bombs left: {bombsLeft}"; } else if (btype != BombType.Normal) { bombText.text = $"{btype} bomb"; } if (SceneManager.GetActiveScene().buildIndex != 0) { if (wallAmount <= 0 && !doingSetup && !exit.activeInHierarchy) { //exitRevealed = true; if (LevelInfo.instance.showDialogue != null) { LevelInfo.instance.showDialogue.SetActive(true); } SoundManager.instance.PlaySingle("reveal"); if (level == SceneManager.sceneCountInBuildSettings - 2) { SoundManager.instance.PlayMusic("ending"); } exit.gameObject.SetActive(true); } } }
public UnitData(UnitColor color, UnitType type, BombType bombType) { this.color = color; this.type = type; this.bombType = bombType; }
public void Init(UnitData curData) { _unitType = curData.type; _bombType = curData.bombType; _unitColor = curData.color; _moveState = UnitMoveState.Default; _elimState = UnitElimState.Default; UpdateCell(); }
private void OnValidate() { if (_bombParameters != null && !_bombParameters.Equals(null)) { return; } _bombParameters = HelperFunctions.FindDefaultParameterAssetOfType <BombType>(); }
public void SpawnBomb(BombType type) { var go = Instantiate (BombPrefab, Vector3.zero, Quaternion.identity) as GameObject; go.transform.parent = transform; var bomb = go.GetComponent<Bomb> (); bomb.Type = type; bomb.Transport = Game.PlayerStats.GetTransportForBomb (bomb); bomb.OnStatusChanged += (oldStatus, newStatus) => OnBombStatusChanged(bomb, newStatus); OnBombSpawned (bomb); }
public BulletEffect(int delay, int time, EFType t, GameObject res, GameObject tar, GameObject self, BombType b, string dmgt) { delayFrame = delay; runningTime = time; type = t; resorce = res; target = tar; selfGO = self; bt = b; dmgTxt = dmgt; }
private BombAsset LoadBombAssetOrPanic(BombType type) { string path = BOMB_OBJECTS_PATH_PREFIX + type.ToString() /*+ ASSET_FILE_TYPE*/; BombAsset bombAsset = Resources.Load<BombAsset>(path); if(bombAsset == null) throw new System.Exception("Load BombAsset of BombType: " + type + " from path: " + path + " failed"); return bombAsset; }
public BombConfig GetBombConfigs(BombType type) { foreach (var bomb in bombsConfigs) { if (bomb.type == type) { return(bomb); } } return(new BombConfig()); }
public Bomb(int x, int y, int power, Player owner, bool autoStart = true, BombType t = BombType.Normal) : base(x, y) { Power = power; Owner = owner; directionMoving = Direction.None; _type = t; itération = 0; if (!autoStart) return; StartBomb(); }
public BombAsset GetBombAsset(BombType type) { if (cache.ContainsKey(type)) return cache[type]; BombAsset bombAsset = LoadBombAssetOrPanic(type); ; cache.Add(type, bombAsset); return bombAsset; }
public GameObject CreateBomb(BombType MType, Vector2 Pos) { GameObject bomb = null; bomb = GameObject.Instantiate(BombPrefabs[(int)MType]) as GameObject; bomb.transform.position = Pos; bomb.SetActive(true); return(bomb); }
public void PutBomb(Player player, BombType bombType, Vector3 position) { if (Instance == null) CreateInstance(); if (Instance != null) { MessageBomb msg = new MessageBomb(); msg.position = position; msg.netId = player.PlayerData.NetId.Value; NetworkManager.singleton.client.Send(MessageType.PutBomb, msg); } }
public static void AddBomb(Unit _Bomb, BombType _Type) { switch (_Type) { case BombType.Stasis: if (Config._StasisBombs.Any <StasisBomb>((Func <StasisBomb, bool>)(x => x._Unit.Equals((Entity)_Bomb)))) { break; } Config._StasisBombs.Add(new StasisBomb() { _Unit = _Bomb }); break; case BombType.Land: if (Config._LandBombs.Any <LandBomb>((Func <LandBomb, bool>)(x => x._Unit.Equals((Entity)_Bomb)))) { break; } Config._LandBombs.Add(new LandBomb() { _Unit = _Bomb }); break; case BombType.Remote: if (Config._RemoteBombs.Any <RemoteBomb>((Func <RemoteBomb, bool>)(x => x._Unit.Equals((Entity)_Bomb)))) { break; } Config._RemoteBombs.Add(new RemoteBomb() { _Unit = _Bomb, _Damage = Config._RSpell.GetAbilitySpecialData("damage", Config._RSpell.Level) + (Config._Hero.HasAghanimsScepter() ? 150f : 0.0f) }); Vector2 _UPos = HUDHelper.GetHPbarPosition(_Bomb); if (Config._BombStacks.FirstOrDefault <BombStack>((Func <BombStack, bool>)(x => (double)HUDHelper.GetHPbarPosition(x._Unit).Distance(_UPos) < 200.0)) != null) { break; } Config._BombStacks.Add(new BombStack(_Bomb) { Creeps = Config._Menu.DetonationMenu.CreepMenu.Creeps, Manta = Config._Menu.DetonationMenu.CreepMenu.Manta, Necro = Config._Menu.DetonationMenu.CreepMenu.Necro, HeroCreeps = Config._Menu.DetonationMenu.HeroCreepMenu.Creeps }); break; } }
public SimpleBomb(int id, BombType type, Living owner, BaseGame game, BallInfo info, Tile shape, bool controled) : base(id, (float)info.Mass, (float)info.Weight, (float)info.Wind, (float)info.DragIndex) { this.m_owner = owner; this.m_game = game; this.m_info = info; this.m_shape = shape; this.m_type = type; this.m_power = info.Power; this.m_radius = info.Radii; this.m_controled = controled; this.m_bombed = false; this.m_lifeTime = 0f; this.digMap = true; }
void OnEnable() { LeftCurrentLaunchForce = MinLaunchForce; RightCurrentLaunchForce = MinLaunchForce; if (LeftAimSlider != null) { LeftAimSlider.value = MinLaunchForce; } if (RightAimSlider != null) { RightAimSlider.value = MinLaunchForce; } BombType = BombType.BOMB; }
public SimpleBomb(int id,BombType type, Player owner,BaseGame game,BallInfo info, Tile shape,bool controled) :base(id,info.Mass,info.Weight,info.Wind,info.DragIndex) { m_owner = owner; m_game = game; m_info = info; m_shape = shape; m_type = type; m_power = info.Power; m_radius = info.Radii; m_controled = controled; m_lifeTime = 0; }
public Bomb(int gridPosX, int gridPosY, int size, BombType type, Player owner) { this.gridPosX = gridPosX; this.gridPosY = gridPosY; this.size = size; this.type = type; this.owner = owner; state = BombState.PLACED; age = 0; animationTick = 0; animationBool = false; animationFrame = 0; }
public SimpleBomb(int id, BombType type, Player owner, BaseGame game, BallInfo info, Tile shape, bool controled) : base(id, info.Mass, info.Weight, info.Wind, info.DragIndex) { m_owner = owner; m_game = game; m_info = info; m_shape = shape; m_type = type; m_power = info.Power; m_radius = info.Radii; m_controled = controled; m_lifeTime = 0; }
public BombPowerUp(Vector2 spritePosition, BombType bombType) : base(spritePosition, "bombUp") { if (bombType == BombType.Up) { Type = PowerUpType.BombUp; timeToDeactivePowerUp = 16f; } else { texture = GfxManager.GetSpritesheet("bombDown").Item1; Type = PowerUpType.BombDown; timeToDeactivePowerUp = 8f; clipOnPicked = AudioManager.GetAudioClip("powerUp2"); } }
/// <summary> /// Drops a bomb. /// </summary> /// <param name="position"></param> /// <param name="offset"></param> /// <param name="vehicle"></param> /// <param name="bombType"></param> public static async void DropBomb(Vehicle vehicle, BombType bombType) { // Stop if the vehicle doesn't exist or if it's dead. if (!vehicle.Exists() || vehicle.IsDead) { return; } // Make sure the doors are open, stop if they aren't. if (!AreBombBayDoorsOpen(vehicle)) { return; } // Get the bomb model. uint bomb = GetBombModel(bombType); // Stop if the model is invalid. if (!IsWeaponValid(bomb)) { return; } // Load the model if it's not loaded yet. if (!HasWeaponAssetLoaded(bomb)) { RequestWeaponAsset(bomb, 31, 26); while (!HasWeaponAssetLoaded(bomb)) { await BaseScript.Delay(0); } } // Get the bomb & offset position. Vector3 dropPos = new Vector3(0f, 0f, 0f); Vector3 offsetPos = new Vector3(0f, 0f, 0f); CalculateBombPositionAndOffset(vehicle, ref dropPos, ref offsetPos); /* This is actually ShootSingleBulletBetweenCoordsWithExtraParams * (but the amount of parameters in the CitizenFX.Core native API are wrong, * so I have to manually invoke the native so i can pass the correct amount of arguments.) */ CitizenFX.Core.Native.Function.Call((CitizenFX.Core.Native.Hash) 0xBFE5756E7407064A, dropPos.X, dropPos.Y, dropPos.Z, offsetPos.X, offsetPos.Y, offsetPos.Z, 0, true, bomb, PlayerPedId(), true, true, -4f, vehicle.Handle, false, false, false, true, true, false); SoundController.PlayGameSoundFromEntity(SoundController.GameSounds.bomb_deployed, vehicle); }
// 폭탄 세팅, 프리펩 등록 void MakeBombObject(Sprite sprite, Color color, string name, BombType bombType) { if (name == null) { return; } GameObject bomb = new GameObject(name); bomb.AddComponent <SpriteRenderer>(); bomb.GetComponent <SpriteRenderer>().sprite = sprite; bomb.GetComponent <SpriteRenderer>().color = color; bomb.GetComponent <SpriteRenderer>().sortingOrder = 1; bombPaths[(int)bombType] = MakePrefab(bomb); DestroyImmediate(bomb, true); }
// 폭탄 만들기 메뉴 함수 void MakeMenu_Bomb() { bomb_type = (BombType)EditorGUILayout.EnumPopup("Select Bomb Type", bomb_type, GUILayout.Width(350.0f)); if (bomb_type == (BombType.Color)) { if (bombPaths[(int)BombType.Color] != null) { bombInfo = LoadObjectInfo(bombPaths[(int)BombType.Color]); } } else if (bomb_type == (BombType.ColumnArrow)) { if (bombPaths[(int)BombType.ColumnArrow] != null) { bombInfo = LoadObjectInfo(bombPaths[(int)BombType.ColumnArrow]); } } else if (bomb_type == (BombType.RowArrow)) { if (bombPaths[(int)BombType.RowArrow] != null) { bombInfo = LoadObjectInfo(bombPaths[(int)BombType.RowArrow]); } } else if (bomb_type == (BombType.Adjacent)) { if (bombPaths[(int)BombType.Adjacent] != null) { bombInfo = LoadObjectInfo(bombPaths[(int)BombType.Adjacent]); } } bombInfo.name = EditorGUILayout.TextField("Bomb prefab name", bombInfo.name, GUILayout.Width(350.0f)); bombInfo.color = EditorGUILayout.ColorField("Bomb Color", bombInfo.color, GUILayout.Width(370.0f)); bombInfo.image = (Sprite)EditorGUILayout.ObjectField(bombInfo.image, typeof(Sprite), false, GUILayout.Width(370.0f)); if (bombInfo.image != null) { GUILayout.Box(bombInfo.image.texture, GUILayout.Width(120.0f), GUILayout.Height(120.0f)); } if (GUILayout.Button("Create Bomb", GUILayout.Width(150.0f))) { MakeBombObject(bombInfo.image, bombInfo.color, bombInfo.name, bomb_type); } }
private void FireRight() { if (SpecialCount <= 0) { BombType = BombType.BOMB; } GameObject shootSmoke; switch (BombType) { case BombType.SPIKEBOMB: Rigidbody spikeBombInstance = Instantiate(SpikeBombPrefab, BackFireTransform.transform.position, BackFireTransform.rotation) as Rigidbody; ShootingAudio.volume = 1f; ShootingAudio.clip = MineClip; --SpecialCount; break; case BombType.SOAPBOMB: Rigidbody soapBombInstance = Instantiate(SoapBombPrefab, RightFireTransform.transform.position, RightFireTransform.rotation) as Rigidbody; soapBombInstance.velocity = RightCurrentLaunchForce * RightFireTransform.forward; shootSmoke = Instantiate(ShootSmokePrefab, RightFireTransform.transform.position, RightFireTransform.rotation); Destroy(shootSmoke, 1); ShootingAudio.volume = 1f; ShootingAudio.clip = ShootClip; --SpecialCount; break; default: Rigidbody bombInstance = Instantiate(BombPrefab, RightFireTransform.transform.position, RightFireTransform.rotation) as Rigidbody; bombInstance.velocity = RightCurrentLaunchForce * RightFireTransform.forward; shootSmoke = Instantiate(ShootSmokePrefab, RightFireTransform.transform.position, RightFireTransform.rotation); Destroy(shootSmoke, 1); ShootingAudio.volume = 1f; ShootingAudio.clip = ShootClip; break; } ShootingAudio.Play(); RightFired = true; RightCurrentLoadTime = LoatTime; RightCurrentLaunchForce = MinLaunchForce; }
public void Explode() { //Center explosion sprite switch and instantiate player = Player.instance.gameObject; position = new Vector3(Mathf.RoundToInt(transform.position.x), Mathf.RoundToInt(transform.position.y), 0); GameObject centerFire = Instantiate(explosionPrefab, position, Quaternion.identity); explosionLength = player.GetComponent <Player>().explosionLength; BombType btype = Player.instance.bombType; SoundManager.instance.PlaySingle("blast"); FindObjectOfType <ShakeBehaviour>().TriggerShake(); if (btype == BombType.Normal) { StartCoroutine(CreateExplosions(Vector3.up)); StartCoroutine(CreateExplosions(Vector3.right)); StartCoroutine(CreateExplosions(Vector3.down)); StartCoroutine(CreateExplosions(Vector3.left)); } else if (btype == BombType.Horizontal) { explosionLength = 9; StartCoroutine(CreateExplosions(Vector3.right)); StartCoroutine(CreateExplosions(Vector3.left)); } else if (btype == BombType.Vertical) { explosionLength = 9; StartCoroutine(CreateExplosions(Vector3.up)); StartCoroutine(CreateExplosions(Vector3.down)); } else if (btype == BombType.Cross) { explosionLength = 9; StartCoroutine(CreateExplosions(Vector3.up)); StartCoroutine(CreateExplosions(Vector3.right)); StartCoroutine(CreateExplosions(Vector3.down)); StartCoroutine(CreateExplosions(Vector3.left)); } Player.instance.bombType = BombType.Normal; }
void Awake() { // Automatically set reference to Audio Manager, usually lost with Scene load audioManager = GameObject.FindGameObjectWithTag("AudioManager"); mainCamera = Camera.main; // Store reference to the main camera bombType = BombType.Normal; // Set normal bomb to be selected by default // Ensure the object is not deleted while changing scene DontDestroyOnLoad(this); // Make sure there are only one instance if (FindObjectsOfType(GetType()).Length > 1) { // Destroy if copies found Destroy(gameObject); } LoadHighScore(); }
public BombObject(int id,BombType type, Player owner, Tile shape, int radius, bool controled, float mass, float gravityFactor, float windFactor, float airResitFactor,double power) : base(id) { _power = power; _owner = owner; _controled = controled; _mass = mass; _gravityFactor = gravityFactor; _windFactor = windFactor; _airResitFactor = airResitFactor; _type = type; _isHole = true; _radius = radius; _vx = new EulerVector(0, 0, 0); _vy = new EulerVector(0, 0, 0); _shape = shape; _rect = new Rectangle(-3,-3,6,6); }
public BombObject(int id,BombType type, Player owner, Tile shape, int radius, bool controled,double power) :this(id,type,owner,shape,radius,controled,10,100,1,1,power) { }
bool TryElim(Grid g,out List<Grid> finalList,out BombType curBombType) { finalList = new List<Grid>(); curBombType = BombType.None; List<Grid> leftList = new List<Grid>(); CheckSameColorAndAdd(g,0,-1,leftList); List<Grid> rightList = new List<Grid>(); CheckSameColorAndAdd(g,0,1,rightList); List<Grid> upList = new List<Grid>(); CheckSameColorAndAdd(g,1,0,upList); List<Grid> downList = new List<Grid>(); CheckSameColorAndAdd(g,-1,0,downList); int horCount = leftList.Count + rightList.Count + 1; int verCount = upList.Count + downList.Count + 1; var leftUpGrid = mainGrids [g.Row + 1, g.Col - 1]; bool isMatchLeftUp = g.isMatchColor(leftUpGrid); var upRightGrid = mainGrids [g.Row + 1, g.Col + 1]; bool isMatchUpRight = g.isMatchColor(upRightGrid); var rightDownGrid = mainGrids [g.Row - 1, g.Col + 1]; bool isMatchRightDown = g.isMatchColor(rightDownGrid); var downLeftGrid = mainGrids [g.Row - 1, g.Col - 1]; bool isMatchDownLeft = g.isMatchColor(downLeftGrid); //striped candy // List<Grid> finalList = new List<Grid>(); if (verCount >= 5 && horCount >= 2) { //Coloring candy Debug.Log("Coloring candy"); finalList.AddRange (upList); finalList.AddRange (downList); finalList.AddRange (rightList); finalList.AddRange (leftList); curBombType = BombType.Coloring; // ElimGridListAndGenBomb (finalList, g,BombType.Coloring); } else if (horCount >= 5 && verCount >= 2) { //Coloring candy Debug.Log("Coloring candy"); finalList.AddRange (upList); finalList.AddRange (downList); finalList.AddRange (rightList); finalList.AddRange (leftList); // ElimGridListAndGenBomb (finalList, g,BombType.Coloring); curBombType = BombType.Coloring; } else if (verCount >= 5 && horCount == 1) { //color candy Debug.Log("Color candy"); finalList.AddRange (upList); finalList.AddRange (downList); finalList.AddRange (rightList); finalList.AddRange (leftList); // ElimGridListAndGenBomb (finalList, g,BombType.Color); curBombType = BombType.Color; } else if (horCount >= 5 && verCount == 1) { //color candy Debug.Log("Color candy"); finalList.AddRange (upList); finalList.AddRange (downList); finalList.AddRange (rightList); finalList.AddRange (leftList); curBombType = BombType.Color; } else if (leftList.Count > 0 && upList.Count > 0 && isMatchLeftUp) { //fish candy Debug.Log("fish1 candy"); finalList.AddRange (upList); finalList.AddRange (downList); finalList.AddRange (rightList); finalList.AddRange (leftList); finalList.Add (leftUpGrid); curBombType = BombType.Fish; } else if (upList.Count > 0 && rightList.Count > 0 && isMatchUpRight) { //fish candy Debug.Log("fish2 candy"); finalList.AddRange (upList); finalList.AddRange (downList); finalList.AddRange (rightList); finalList.AddRange (leftList); finalList.Add (upRightGrid); curBombType = BombType.Fish; } else if (rightList.Count > 0 && downList.Count > 0 && isMatchRightDown) { //fish candy Debug.Log("fish3 candy"); finalList.AddRange (upList); finalList.AddRange (downList); finalList.AddRange (rightList); finalList.AddRange (leftList); finalList.Add (rightDownGrid); curBombType = BombType.Fish; } else if (downList.Count > 0 && leftList.Count > 0 && isMatchDownLeft) { //fish candy Debug.Log("fish4 candy"); finalList.AddRange (upList); finalList.AddRange (downList); finalList.AddRange (rightList); finalList.AddRange (leftList); finalList.Add (downLeftGrid); curBombType = BombType.Fish; } else if (horCount >= 3 && horCount < 5 && verCount >= 3 && verCount < 5) { //square bomb Debug.Log("square candy"); finalList.AddRange (upList); finalList.AddRange (downList); finalList.AddRange (rightList); finalList.AddRange (leftList); curBombType = BombType.Square; } else if (verCount == 4 && horCount < 3) { //form hor Debug.Log("hor candy"); finalList.AddRange (upList); finalList.AddRange (downList); curBombType = BombType.Horizontal; } else if (horCount == 4 && verCount < 3) { //form verBomb Debug.Log("ver candy"); finalList.AddRange (rightList); finalList.AddRange (leftList); curBombType = BombType.Vertical; } else if (verCount == 3 && horCount < 3) { //vertical elim Debug.Log("verelim candy"); finalList.AddRange (upList); finalList.AddRange (downList); ElimGridListAndGenBomb (finalList, g); } else if (verCount < 3 && horCount == 3) { //horizon elim Debug.Log("horelim candy"); finalList.AddRange (rightList); finalList.AddRange (leftList); ElimGridListAndGenBomb (finalList, g); } else { // Debug.Log("no elim"); // _state = GameState.Normal; return false; } // mainGrids.DropCell (Constants.FORM_TIME + 0.1f); // mainGrids.DropNewCells (Constants.FORM_TIME + 0.1f); return true; }
public UpgradeBomb(int x, int y, BombType bt) : base(x, y) { _type = bt; }
//store the bomb type and set the colour as appropriate public void SetType(BombType type) { bombType = type; renderer.material.color = GetBombColour(bombType); }
void ElimGridListAndGenBomb(List<Grid> lst,Grid g,BombType genBomb = BombType.None) { if (lst.Count == 0) { return; } if (genBomb == BombType.None) { g.DestroyCell (Constants.CELL_ELIM_TIME,true,g); for (int i = 0; i < lst.Count; ++i) { Grid curGrid = lst [i]; curGrid. DestroyCell(Constants.CELL_ELIM_TIME,true,g); } } else { if (g.bombType != BombType.None) { BombManager.instance.triggerBomb(g,g); } if (!g.Cell) { return; } g.Cell.cellType = CellType.Bomb; g.Cell.cellBombType = genBomb; if (g.bombType == BombType.Color) { g.Cell.cellColor = CellColor.All; } g.Cell.highZorder(); g.Cell.updateCell (Constants.FORM_TIME); for (int i = 0; i < lst.Count; ++i) { Grid curGrid = lst [i]; curGrid. MoveToAndElim(g,Constants.FORM_TIME,g); } } }
Color GetBombColour(BombType type) { switch(type) { case BombType.speed: return speedCol; case BombType.blastpower: return blastCol; case BombType.threatlvl: return threatCol; case BombType.timeslow: return timeCol; default: Debug.LogError("Unknown bomb colour requested " + type.ToString()); return Color.white; } }
public void ChangeBombTypeFrequence(BombType ut, int freq) { var e = _root.Elements("Game").Where(c => String.Compare(Type.ToString(), c.Attribute("type").Value) == 0).Descendants("Upgrades");//.FirstOrDefault(c => String.Compare(ut.ToString(), c.Element("Upgrade").Value) == 0); XElement theut = null; foreach (var element in e.Elements("BombType").Where(element => String.Compare(ut.ToString(), element.Value) == 0)) { theut = element; } if (theut != null) { theut.Attribute("currentFreq").Value = freq + ""; } }
public void SetBombType(BombType type) { bombType = type; }
public void InitCrazySkills() { Speed = 7; BombCount = 9; BombPower = 1; CanKick = true; InvertedDirections = false; AvailableBombCount = 9; Lives = GameParameters._.LivesCount; sens = Direction.Down; newsens = Direction.Down; _invincible = false; teleportme = false; bomb = BombType.None; secAvaliable = true; stack = 8; freeze = false; cursed = false; }
private void InitSkills() { Speed = 3; BombCount = 1; BombPower = 1; CanKick = false; InvertedDirections = false; AvailableBombCount = 1; Lives = GameParameters._.LivesCount; sens = Direction.Down; newsens = Direction.Down; _invincible = false; teleportme = false; bomb = BombType.None; secAvaliable = false; freeze = false; cursed = false; }