public void Invoke(EAbilities ability, Vector2 _direction, Vector2 _pos, int _targetLayer) { AbilityBase newAbility = null; if (cooldown.IsStopped()) { switch (ability) { case EAbilities.FIREBALL: newAbility = new Fireball(_direction, _pos, _targetLayer); break; case EAbilities.PYROBLAST: newAbility = new Pyroblast(_direction, _pos, _targetLayer); break; case EAbilities.CHAIN_LIGHTNING: newAbility = new ChainLightning(_direction, _pos, _targetLayer); break; default: newAbility = new Fireball(_direction, _pos, _targetLayer); break; } cooldown.WaitTime = newAbility.cooldown; cooldown.Start(); AddChild(newAbility); } }
void Start() { #if UNITY_EDITOR Debug.Log("Editor"); pcMovement = true; #elif UNITY_STANDALONE_WIN Debug.Log("Windows"); pcMovement = true; #endif rb = GetComponent <Rigidbody2D>(); sr = GetComponent <SpriteRenderer>(); gm = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManager>(); chainLightning = GetComponentInChildren <ChainLightning>(); for (int i = 0; i < PlayerPrefs.GetInt("PlayerLevel"); i++) { health += 2; } currentWeapon = inventory[0]; isDamageable = true; health = maxHealth; standstill = true; timeNotMoved = 0f; //canDash = false; // startTimeBtwDashes = timeBtwDashes; streak = 0; takenDamage = false; }
private int chainLightning() { var multi = getAttackMultiplier(); var increase = getAttackModifier(); var chain = new ChainLightning(); Cooldowns[1] = chain.Cooldown; return(chain.Action(SpellPower, Crit, multi, increase)); }
public override void Begin(Single p_lifetime, FXArgs p_args) { base.Begin(p_lifetime, p_args); if (m_ImpactPrefab != null) { UnityEventArgs <FXArgs> p_args2 = new UnityEventArgs <FXArgs>(this, p_args); Transform transform = null; FXTags component = p_args.Origin.GetComponent <FXTags>(); if (component != null) { GameObject gameObject = component.FindOne("CastSpot"); if (gameObject != null) { transform = gameObject.transform; } } GameObject gameObject2; if (transform != null) { gameObject2 = Helper.Instantiate <GameObject>(m_ImpactPrefab, transform.transform.position); transform.AddChildAlignOrigin(gameObject2.transform); } else { gameObject2 = Helper.Instantiate <GameObject>(m_ImpactPrefab, p_args.OriginTransform.position); } m_Instance = gameObject2; ChainLightning component2 = m_Instance.GetComponent <ChainLightning>(); if (p_args.Targets != null) { foreach (GameObject gameObject3 in p_args.Targets) { if (!String.IsNullOrEmpty(m_TargetsTag)) { FXTags component3 = gameObject3.GetComponent <FXTags>(); if (component3 != null) { component2.Targets.Add(component3.FindOne(m_TargetsTag)); } else { component2.Targets.Add(gameObject3); } } else { component2.Targets.Add(gameObject3); } } } else { component2.Targets.Add(p_args.Target); } SendBroadcastBeginEffect <UnityEventArgs <FXArgs> >(gameObject2, p_args2); } }
public void setChainLightning(ChainLightning cl) { cl.isEnabled = false; if (_chainLightningPool.ContainsKey(cl.type) == false) { _chainLightningPool.Add(cl.type, new Stack <ChainLightning>()); } _chainLightningPool[cl.type].Push(cl); }
public ChainLightning getChainLightning(string chainId, string hitId) { ChainLightning cl; if (_chainLightningPool.ContainsKey(chainId) && _chainLightningPool[chainId].Count > 0) { cl = _chainLightningPool[chainId].Pop(); } else { cl = new ChainLightning(chainId, hitId); } cl.uniqueNo = _bulletUniqueNo; ++_chainUniqueNo; chainLightningList.Add(cl); return(cl); }
// Start is called before the first frame update void Start() { LifeTime = maxLifeTime; instance = GameManagerController.instance; game1Instance = game1.game1Instance; chainLightning = GetComponent <ChainLightning>(); lineRenderer = GetComponent <LineRenderer>(); // 初始化距离矩阵 itemCount = transforms.Count; if (itemCount < 2) { Debug.LogError("Transform list is not signed correctly."); } else { initDistanceMatrix(); } }
public Rotation(ShamanTalents talents, SpellBox spellBox, IRotationOptions rotOpt) : this() { Talents = talents; LB = spellBox.LB; CL = spellBox.CL; LvB = spellBox.LvB; LvBFS = spellBox.LvBFS; FS = spellBox.FS; ES = spellBox.ES; FrS = spellBox.FrS; FN = spellBox.FN; ST = spellBox.ST; MT = spellBox.MT; FE = spellBox.FE; useDpsFireTotem = rotOpt.UseDpsFireTotem; CalculateRotation(rotOpt.UseFireNova, rotOpt.UseChainLightning, rotOpt.UseDpsFireTotem, rotOpt.UseFireEle); }
private void CreateChainLightningObjectInPool() { ChainLightning go; if (chainLightningPooledObject == null) { go = new ChainLightning(); } else { go = Instantiate(chainLightningPooledObject) as ChainLightning; } go.gameObject.SetActive(false); PooledChainLightning.Add(go); if (Parent != null) { go.transform.parent = this.Parent; } else { go.transform.parent = transform; } }
void OnTriggerEnter2D(Collider2D collision) { switch (collision.gameObject.layer) { case 11: if (!myEnemyBase.incam || myEnemyBase.enemyState == EnemyBase.EnemyState.die) { return; } if (collision.tag == "bulletW5") { explobulletW5 = ObjectPoolerManager.Instance.exploBulletW5Pooler.GetPooledObject(); explobulletW5.transform.position = collision.transform.position; explobulletW5.SetActive(true); SoundController.instance.PlaySound(soundGame.soundexplow6); collision.gameObject.SetActive(false); } else if (collision.tag == "bulletuav") { TakeDamage(GameController.instance.uav.damageBullet, false, false); myEnemyBase.TakeDamage(PlayerController.instance.damageBullet, false, false, false); collision.gameObject.SetActive(false); } else if (collision.tag == "bulletnpc") { TakeDamage(GameController.instance.uav.damageBullet / 3, false, false); myEnemyBase.TakeDamage(PlayerController.instance.damageBullet / 3, false, false, false); collision.gameObject.SetActive(false); } else { takecrithit = Random.Range(1, 100); if (takecrithit <= PlayerController.instance.critRate) { if (collision.tag != "explobulletW5") { TakeDamage(PlayerController.instance.damageBullet + (PlayerController.instance.damageBullet / 100 * PlayerController.instance.critDamage), true, false); myEnemyBase.TakeDamage(PlayerController.instance.damageBullet + (PlayerController.instance.damageBullet / 100 * PlayerController.instance.critDamage), true, true, false); } else { TakeDamage(PlayerController.instance.damageBullet + (PlayerController.instance.damageBullet / 100 * PlayerController.instance.critDamage), true, true); myEnemyBase.TakeDamage(PlayerController.instance.damageBullet + (PlayerController.instance.damageBullet / 100 * PlayerController.instance.critDamage), true, true, true); } if (!GameController.instance.listcirtwhambang[0].gameObject.activeSelf) { switch (GameController.instance.currentChar) { case 0: SoundController.instance.PlaySound(soundGame.soundCritHit); break; case 1: SoundController.instance.PlaySound(soundGame.soundcrithitnv2); break; } } GameController.instance.listcirtwhambang[0].DisplayMe(transform.position); } else { if (collision.tag != "explobulletW5") { TakeDamage(PlayerController.instance.damageBullet, false, false); myEnemyBase.TakeDamage(PlayerController.instance.damageBullet, false, true, false); } else { TakeDamage(PlayerController.instance.damageBullet, false, true); myEnemyBase.TakeDamage(PlayerController.instance.damageBullet, false, true, true); } } if (collision.tag != "shotgun" && collision.tag != "explobulletW5") { collision.gameObject.SetActive(false); } if (collision.tag == "bulletw6") { chainLightning = ObjectPoolManagerHaveScript.Instance.chainlightningPooler.GetChainLightningPooledObject(); chainLightning.originPos = gameObject; chainLightning.transform.position = gameObject.transform.position; chainLightning.gameObject.SetActive(true); } } break; case 14: if (!myEnemyBase.incam || myEnemyBase.enemyState == EnemyBase.EnemyState.die) { return; } if (collision.tag == "effectexploboomplane") { TakeDamage(GameController.instance.maybay.damageboom, false, false); myEnemyBase.TakeDamage(GameController.instance.maybay.damageboom, false, true, false); } else { TakeDamage(PlayerController.instance.damgeGrenade, false, false); myEnemyBase.TakeDamage(PlayerController.instance.damgeGrenade, false, true, false); if (currentHealth <= 0) { if (!GameController.instance.listcirtwhambang[1].gameObject.activeSelf) { SoundController.instance.PlaySound(soundGame.soundGrenadeKill); } GameController.instance.listcirtwhambang[1].DisplayMe(transform.position); MissionController.Instance.DoMission(1, 1); DataController.instance.DoAchievement(3, 1); DataController.instance.DoDailyQuest(1, 1); } } break; case 26: if (!myEnemyBase.incam || myEnemyBase.enemyState == EnemyBase.EnemyState.die) { return; } TakeDamage(PlayerController.instance.damgeGrenade, false, false); myEnemyBase.TakeDamage(PlayerController.instance.damgeGrenade, false, true, false); break; case 27: if (!myEnemyBase.incam || myEnemyBase.enemyState == EnemyBase.EnemyState.die) { return; } TakeDamage(PlayerController.instance.damageBullet * 3f, false, false); myEnemyBase.TakeDamage(PlayerController.instance.damageBullet * 3f, false, true, false); switch (GameController.instance.currentChar) { case 0: SoundController.instance.PlaySound(soundGame.sounddapchao); break; case 1: SoundController.instance.PlaySound(soundGame.sounddaonv2); break; } if (currentHealth <= 0) { if (!GameController.instance.listcirtwhambang[2].gameObject.activeSelf) { SoundController.instance.PlaySound(soundGame.soundWham); } GameController.instance.listcirtwhambang[2].DisplayMe(transform.position); MissionController.Instance.DoMission(5, 1); } break; case 20: gameObject.SetActive(false); break; } }
public override string[] Ability2() { var chain = new ChainLightning(); return(chain.Info()); }