private void OnTriggerEnter(Collider other) { if (other.transform.tag == "PlayerEffect") { // 이펙트에 달려있는 스크립트 PlayerEffect _playerEffect = other.GetComponent <PlayerEffect>(); // 데미지 계산 및 적용 float damage = _playerEffect.CalculatedDamage(); ApplyDamage(damage); // 플레이어에 역경직 적용 StartCoroutine(GameObject.Find("Player").GetComponent <Player>().AttackRigidy(0.05f)); if (MonsterHP > 0) { // 피격 모션 gameObject.GetComponent <Animator>().Play("GetHit", -1, 0); //gameObject.GetComponent<GreenSlime>()._enemyState = GreenSlime.EnemyState.GetHit; // 에네미 상태변경 // 피격 이펙트 _playerEffect.HitEffect(other.ClosestPoint(gameObject.transform.position)); } // 피격 사운드 // 뭐가있지?... } }
private void Awake() { _rigid = GetComponent <Rigidbody2D>(); _controller = GetComponent <PlayerController>(); player_SE = GetComponentInChildren <PlayerSoundEffect>(); player_Effect = GetComponentInChildren <PlayerEffect>(); }
public void Fill(PlayerEffect NewEffect) { Assert.IsNull(Effect, "Player already has effect."); Timer = 0.0f; Effect = NewEffect; Effect.OnStartEffect(this.gameObject); }
/// <summary> /// Initializes a new instance of the <see cref="ReceivingEffectEventArgs"/> class. /// </summary> /// <param name="player">The <see cref="Player"/> receiving the effect.</param> /// <param name="effect">The <see cref="PlayerEffect"/> being added to the player.</param> /// <param name="state">The state the effect is being changed to.</param> /// <param name="currentState">The current state of the effect being changed.</param> public ReceivingEffectEventArgs(Player player, PlayerEffect effect, byte state, byte currentState) { Player = player; Effect = effect; this.state = state; CurrentState = currentState; }
public void DestroyAllCharacter() { GameObject[] characters = GameObject.FindGameObjectsWithTag("PlayerBlack").Concat(GameObject.FindGameObjectsWithTag("PlayerWhite")).ToArray(); PlayerEffect[] playerEffects = new PlayerEffect[characters.Length]; RecordController[] recordControllers = new RecordController[characters.Length]; for (int i = 0; i < characters.Length; i++) { PlayerEffect effect = characters[i].GetComponent <PlayerEffect>(); RecordController record = characters[i].GetComponent <RecordController>(); if (effect != null) { playerEffects[i] = effect; } if (record != null) { recordControllers[i] = record; } } foreach (PlayerEffect effect in playerEffects) { effect.PlayVanishEffect(); } foreach (RecordController rec in recordControllers) { rec.StopAllCoroutines(); } }
public override void onBreakDuration(float deltaTime) { if (passTime + deltaTime < durationTime) { passTime += deltaTime; } else { List <GameObject> players = findRemainEnemys(); for (int i = 0; i < players.Count; ++i) { PlayerAttribute attr = players[i].GetComponent <PlayerAttribute>(); if (attr.seat == brokenSeat) { attr.isChaos = false; PlayerEffect effect = players[i].GetComponent <PlayerEffect>(); if (effect.isPlay(EffectEunm.CHAOS)) { effect.Stop(EffectEunm.CHAOS); } brokenSeat = -1; } } } }
PlayerEffect GetPlayerEffectPrefab(List <PrefabEffectsSettings.ParticleEffectsType> particleEffects, int num, Transform prefParent) { var prefab = particleEffects[num].effectPrefab; if (prefab != null) { Quaternion startRot = prefab.transform.localRotation; Vector3 startPos = prefab.transform.localPosition; PlayerEffect thisInstPrefab = Container.InstantiatePrefabForComponent <PlayerEffect>(prefab); if (prefParent != null) { thisInstPrefab.transform.SetParent(prefParent); } thisInstPrefab.transform.localRotation = startRot; thisInstPrefab.transform.localPosition = startPos; return(thisInstPrefab); } else { return(null); } }
public override void onBreakDelay(float deltaTime) { if (passTime + deltaTime < delayTime) { passTime += deltaTime; onDelay(deltaTime); } else { FightScene.instance.audioController.SoundPlay(AudioEunm.groupChaosDelay); List <GameObject> players = findRemainEnemys(); for (int i = 0; i < players.Count; ++i) { PlayerAttribute attr = players[i].GetComponent <PlayerAttribute>(); if (attr.seat == brokenSeat) { PlayerChildren playerChildren = players[i].GetComponent <PlayerChildren>(); playerChildren.title.progressActive(false); attr.isChaos = true; PlayerEffect effect = players[i].GetComponent <PlayerEffect>(); if (!effect.isPlay(EffectEunm.CHAOS)) { effect.Play(EffectEunm.CHAOS); } } } passTime = 0; needUpdate = (int)SkillEunm.SkillState.BreakDuration; } }
private void Start() { player = transform.parent.gameObject; player_Controller = player.GetComponent <PlayerController>(); player_SE = player.GetComponentInChildren <PlayerSoundEffect>(); player_Effect = player.GetComponentInChildren <PlayerEffect>(); player_Rigid = player.GetComponent <Rigidbody2D>(); }
void Awake() { instance = this; controller = GetComponent<CharacterController>(); anim = GetComponent<Animator>(); pEffect = GetComponent<PlayerEffect>(); wahleMove = GameObject.FindGameObjectWithTag("WAHLE").GetComponent<WahleMove>(); }
void ShowEffect(string effect) { PlayerEffect pe = null; if (mDict.TryGetValue(effect, out pe)) { pe.ShowEffect(); } }
public void Respawn(Spawn spawn) { _bike.Init(spawn, false); SetCrashed(false); SetCrashedInto(null); SetSpectating(false); _currentPowerUpType = PowerUpType.Nothing; _effect = PlayerEffect.None; }
public override void afterDuration() { boxCollider.enabled = true; capsuleCollider.enabled = false; playerAttribute.hasProtection = false; PlayerEffect playerEffect = GetComponent <PlayerEffect>(); playerEffect.Stop(EffectEunm.COVER); }
public void RpcAddEffect(PlayerEffect effect) { // Add it. PlayerEffects.Add(effect); // Notify event listeners of changes. OnPlayerEffectsChanged.Invoke(); OnPlayerEffectsAdded.Invoke(effect); }
protected void ApplyVisualEffect(Player player, PlayerEffect visualEffect, AbilityStats stats) { if (visualEffect == PlayerEffect.None) { return; } player.ActivateBuffUI(visualEffect, stats.duration); }
public void AddPlayerEffect(PlayerEffect effect) { if (effect == null || playerEffects == null) { return; } playerEffects.Add(effect); }
public void ShowEffect(string effectName) { PlayerEffect pe = null; effectDic.TryGetValue(effectName, out pe); if (pe != null) { pe.ShowEffect(); } }
// Use this for initialization void Awake() { //取得 _controller = GetComponent <PlayerController>(); _shoot = GetComponent <PlayerShoot>(); player_Effect = GetComponentInChildren <PlayerEffect>(); player_SE = GetComponentInChildren <PlayerSoundEffect>(); player_Body = GetComponentInChildren <PlayerBodyCollision>(); _rigid = GetComponent <Rigidbody2D>(); kick_Collision = GetComponentInChildren <PlayerKickCollision>(); }
protected virtual void OnCollisionEnter(Collision collision) { if (collision.collider.tag == Tags.Player) { Player player = collision.collider.GetComponent <Player> (); switch (tileType) { case TileType.SHIELD: if (player != null && player.PlayerEffects != null) { PlayerEffect shieldEffect = player.PlayerEffects.Find(e => e.Type == PlayerEffect.EffectType.SHIELD); if (shieldEffect == null) { player.AddPlayerEffect(new ShieldEffect(0f, player)); } } gameObject.SetActive(false); break; case TileType.ROCKET: if (player != null && player.PlayerEffects != null) { PlayerEffect rocketEffect = player.PlayerEffects.Find(e => e.Type == PlayerEffect.EffectType.ROCKET_JUMP); if (rocketEffect == null) { player.AddPlayerEffect(new RocketJumpEffect(3f, 50f, player)); } } gameObject.SetActive(false); break; case TileType.BRICK: for (int i = 0; i < collision.contacts.Length; i++) { if (collision.contacts [i].point.y > transform.position.y) { gameObject.SetActive(false); break; } } return; case TileType.SPIKE: return; default: gameObject.SetActive(false); break; } } }
public override void onSkill() { boxCollider.enabled = false; capsuleCollider.enabled = true; playerAttribute.hasProtection = true; PlayerEffect playerEffect = GetComponent <PlayerEffect>(); playerEffect.Play(EffectEunm.COVER); FightScene.instance.audioController.SoundPlay(AudioEunm.protectiveCover); passTime = 0; needUpdate = (int)SkillEunm.SkillState.Duration; }
// Update is called once per frame void Update() { if (!Empty()) { Timer += Time.deltaTime; if (Timer > Effect.Duration) { Effect.OnStopEffect(this.gameObject); Effect = null; } } }
// Use this for initialization void Start() { //弾のオブジェクトプール ObjectPoolManager.Instance.Create_New_Pool(bullet, 10); ObjectPoolManager.Instance.Create_New_Pool(charge_Bullet, 2); bullet_Pool = ObjectPoolManager.Instance.Get_Pool(bullet); charge_Bullet_Pool = ObjectPoolManager.Instance.Get_Pool(charge_Bullet); //取得 player_Manager = PlayerManager.Instance; player_Controller = GetComponent <PlayerController>(); player_Effect = GetComponentInChildren <PlayerEffect>(); }
private void Start() { //取得 player_Manager = PlayerManager.Instance; _controller = GetComponent <PlayerController>(); player_SE = GetComponentInChildren <PlayerSoundEffect>(); player_Effect = GetComponentInChildren <PlayerEffect>(); _attack = GetComponent <PlayerAttack>(); _anim = GetComponent <Animator>(); _rigid = GetComponent <Rigidbody2D>(); attack_Collision = GetComponentInChildren <PlayerChargeAttackCollision>(); camera_Shake = GameObject.FindWithTag("MainCamera").GetComponent <CameraShake>(); }
//Start private void Awake() { //取得 main_Camera = GameObject.FindWithTag("MainCamera"); beetle_Body = transform.Find("BeetleBody").gameObject; body_Collision = GetComponentInChildren <PlayerBodyCollision>(); foot_Collision = GetComponentInChildren <PlayerFootCollision>(); _controller = GetComponent <PlayerController>(); player_Effect = GetComponentInChildren <PlayerEffect>(); //初期値代入 default_Gravity = GetComponent <Rigidbody2D>().gravityScale; default_Collider_Offset = GetComponentInChildren <CapsuleCollider2D>().offset; }
private void RemoveUIPlayerEffect(PlayerEffect playerEffect) { if (uiPlayerEffects.TryGetValue(playerEffect, out UIPlayerEffect uiPlayerEffect)) { uiPlayerEffects.Remove(playerEffect); foreach (var graphic in uiPlayerEffect.TargetGraphics) { uiPlayerEffectsContainerColorInvert.RemoveColorOption(graphic); } Destroy(uiPlayerEffect.gameObject); } }
public void Enter(Player player) { // Apply effect 'Cards' to player int i = 0; while (i < player.playerEffects.Count) { PlayerEffect playerEffect = player.playerEffects.ElementAt(i); if (playerEffect is Card) { playerEffect.Apply(player); } i++; } }
void ShowEffectBird() //攻击结束的时候出现火鸟特效 { string effect = "FirePhoenixMobile"; PlayerEffect pe = null; mDict.TryGetValue(effect, out pe); List <GameObject> mList = GetEnemyInAttackRange(AttackRange.Around); //around foreach (GameObject enemy in mList) //在可攻击的敌人出实例化特效 { GameObject go = Instantiate(pe).gameObject; go.transform.position = transform.position + Vector3.up; go.GetComponent <EffectSettings>().Target = enemy; } }
public void AddBuff(PlayerEffect buff, float duration) { if (!locked && imageMap.ContainsKey(buff)) { Debug.Log("PlayerBuffs AddBuff " + buff + " duration " + duration); buffDurationMap[buff] += duration; imageMap[buff].enabled = true; if (coroutineMap[buff] == null) { Debug.Log("PlayerBuffs AddBuff starting coroutine" + buff); coroutineMap[buff] = StartCoroutine(BuffTick(buff)); } } }
public void ShowEffectDevilHand() { string effectName = "DevilHandMobile"; PlayerEffect playerEffect = null; effectDic.TryGetValue(effectName, out playerEffect); if (playerEffect != null) { foreach (var item in enemyList) { GameObject go = Instantiate <GameObject>(playerEffect.gameObject, item.transform.position, Quaternion.identity); go.GetComponent <PlayerEffect>().ShowEffect(); } } }
public override void afterDuration() { List <GameObject> players = findRemainPlayers(); for (int i = 0; i < players.Count; ++i) { PlayerAttribute attr = players[i].GetComponent <PlayerAttribute>(); attr.isChaos = false; PlayerEffect effect = players[i].GetComponent <PlayerEffect>(); if (effect.isPlay(EffectEunm.CHAOS)) { effect.Stop(EffectEunm.CHAOS); } } }
// Use this for initialization void Start() { //弾のオブジェクトプール ObjectPoolManager.Instance.Create_New_Pool(normal_Bullet, 5); ObjectPoolManager.Instance.Create_New_Pool(bee_Bullet, 5); ObjectPoolManager.Instance.Create_New_Pool(butterfly_Bullet, 5); ObjectPoolManager.Instance.Create_New_Pool(mantis_Bullet, 5); ObjectPoolManager.Instance.Create_New_Pool(spider_Bullet, 5); //取得 player_Manager = PlayerManager.Instance; player_Controller = GetComponent <PlayerController>(); player_Effect = GetComponentInChildren <PlayerEffect>(); player_SE = GetComponentInChildren <PlayerSoundEffect>(); main_Camera = GameObject.FindWithTag("MainCamera"); camera_Shake = main_Camera.GetComponent <CameraShake>(); }
public void UpdateMngr() { if(doTransition) { if(switch_level_transtion <= 0) { this.CurrentLevel = requested_level; Application.LoadLevel(requested_level); graphEffects.Clear(); this.currentEffect = request_effect; doTransition = false; switch_level_transtion = TRANSITION_TIME; } else { switch_level_transtion -= Time.deltaTime * 1000.0f; } } }
public void Respawn(GameObject player) { player.transform.position = LevelStartPos; currentEffect = PlayerEffect.NONE; player.GetComponent<Rigidbody2D>().velocity = Vector3.zero; player.GetComponent<Rigidbody2D>().angularVelocity = 0.0f; this.ApplyEffect(player); }
public void SetNewLevel(string newlevel,PlayerEffect effect) { if(newlevel.ToLower() == "credit" && this.CurrentLevel == "niveau6") gameended = true; if(newlevel.ToLower() == "menu" && gameended) gameended = false; requested_level = newlevel; request_effect = effect; doTransition = true; }