//------------------------------------------------------------------------- // Use those for Attack IEnumerator Attack_01_Coru() { //FX.EffectPlay(FX.SYSTEMS.ENEMY_READY); GameObject Ready = Instantiate(WaitAttack, transform.position + (Vector3.up * (GetComponent <SpriteRenderer>().size.y / 2 + WaitAttack.GetComponent <SpriteRenderer>().size.y / 2)), Quaternion.identity); Ready.transform.parent = transform; yield return(new WaitForSeconds(0.5f)); Destroy(Ready); float ThisTime = Time.time; FX.EffectPlay(FX.ENEMYS.DOLLS_SPEAR); MyWeapon.GetComponent <Animator>().SetBool("Attack", true); while (Time.time - ThisTime <= 0.1f) { Move(2.5f); yield return(null); } yield return(new WaitForSeconds(0.1f)); AttackTime = Time.time; This_State = MON_STATE.IDLE; }
public override void UseSkill() { Use = false; InventoryManager.Instance.GetCogs((int)-price); FX.EffectPlay(FX.SKILLS.SHOCKWAVE); Instantiate(Dispersion, GameManager.Instance.LocalPlayer.transform.position, Quaternion.identity); }
IEnumerator JumpAttack() { isJumpAttack = true; Anim.SetBool("Jump", true); yield return(new WaitForSeconds(0.5f)); FX.EffectPlay(FX.ENEMYS.KNIGHT_JUMP); yield return(new WaitForSeconds(0.3f)); float Scale_X, Scale_Y; Scale_X = Shadow.transform.localScale.x; Scale_Y = Shadow.transform.localScale.y; while (Shadow.transform.localScale.x > 0) { Shadow.transform.localScale -= new Vector3(Mathf.Lerp(0, Scale_X, Time.deltaTime / 0.3f), Mathf.Lerp(0, Scale_Y, Time.deltaTime / 0.3f), 1); //Shadow.transform.localScale -= new Vector3(0.5f, 0.5f, 1); yield return(null); } Shadow.transform.localScale = new Vector3(0, 0, 1); transform.position += new Vector3(0, 30, 0); yield return(new WaitForSeconds(3)); Vector3 Pos = _Player.transform.position; Anim.SetBool("Jump", false); yield return(new WaitForSeconds(1)); transform.position = Pos; while (Shadow.transform.localScale.x < Scale_X) { Shadow.transform.localScale += new Vector3(Mathf.Lerp(0, Scale_X, Time.deltaTime / 0.5f), Mathf.Lerp(0, Scale_Y, Time.deltaTime / 0.5f), 1); yield return(null); } Shadow.transform.localScale = new Vector3(Scale_X, Scale_Y, 1); Anim.SetBool("Attack", true); FX.EffectPlay(FX.ENEMYS.KNIGHT_ATTACK_01); yield return(null); FX.EffectPlay(FX.ENEMYS.KNIGHT_ATTACK_02); Anim.SetBool("Attack", false); yield return(new WaitForSeconds(0.5f)); AttackTime = Time.time; attack = false; isJumpAttack = false; isDashAttack = false; }
public void Reloading() { if (InventoryManager.Instance.Cog < Reload_Cost - (Reload_Cost * ((CostPercent + Player.Cost_Percent) / 100)) || IsReloading) { return; } FX.EffectPlay(FX.PCS.PC_RELOAD); IsReloading = true; InventoryManager.Instance.GetCogs((int)-(Reload_Cost - (Reload_Cost * ((CostPercent + Player.Cost_Percent) / 100)))); StartCoroutine(RELOADING()); }
IEnumerator Attack_Coru() { FX.EffectPlay(FX.ENEMYS.CUCKOO_CLOCK); yield return(null); float PrevTime = Time.time; if (PlayerPosition.x > transform.position.x && Front == -1) { transform.rotation = new Quaternion(0, 0, 0, transform.rotation.w); Front = 1; } else if (PlayerPosition.x <= transform.position.x && Front == 1) { transform.rotation = new Quaternion(0, 180, 0, transform.rotation.w); Front = -1; } Anim.SetBool("Attack", true); FX.EffectPlay(FX.ENEMYS.CUCKOO_DOOR_OPEN); yield return(new WaitForSeconds(0.1f)); Anim.SetBool("Attack", false); Transform Child; Child = Instantiate(child, transform.position, transform.rotation).transform; Child.parent = transform.parent; transform.parent.parent.GetComponent <SpawnManager>().monsterCount++; yield return(null); FX.EffectPlay(FX.ENEMYS.CUCKOO_DOOR_CLOSE); Bird Bird; Bird = Child.GetComponent <Bird>(); yield return(null); Bird.whatState = 0; Bird.direction = _Player.transform.position - transform.position; Bird.PlayerPosition = _Player.transform.position; Bird.Front = Front; Bird.direction.Normalize(); Bird.GetComponent <Animator>().SetInteger("WhatState", 0); Bird.This_State = MON_STATE.DIRECTATTACK; Bird.entityValue = 0; yield return(new WaitForSeconds(0.5f)); yield return(new WaitForSeconds(0.3f)); AttackTime = Time.time; This_State = MON_STATE.IDLE; }
IEnumerator Attack_02_Coru() { //FX.EffectPlay(FX.SYSTEMS.ENEMY_READY); GameObject Ready = Instantiate(WaitAttack, transform.position + (Vector3.up * (GetComponent <SpriteRenderer>().size.y / 2 + WaitAttack.GetComponent <SpriteRenderer>().size.y / 2)), Quaternion.identity); Ready.transform.parent = transform; yield return(new WaitForSeconds(0.5f)); Destroy(Ready); FX.EffectPlay(FX.ENEMYS.DOLLS_GUN); MyWeapon.GetComponent <Doll_Attack_BowGun>().Fire(); AttackTime = Time.time; This_State = MON_STATE.IDLE; }
IEnumerator Attack_O1_Coru() { yield return(null); ////FX.EffectPlay(FX.SYSTEMS.ENEMY_READY); GameObject Ready = Instantiate(WaitAttack, transform.position + (Vector3.up * (GetComponent <SpriteRenderer>().size.y + WaitAttack.GetComponent <SpriteRenderer>().size.y / 2)), Quaternion.identity); Ready.transform.parent = transform; yield return(new WaitForSeconds(0.5f)); Destroy(Ready); FX.EffectPlay(FX.ENEMYS.MAGE_ATTACK_01); Attack_01(); AttackTime = Time.time; This_State = MON_STATE.TRACKING; }
public override void StartAttack() { AttackSpeed = GameManager.Instance.LocalPlayer.SeetAttackSpeed(AttackSpeed); FX.EffectPlay(FX.PCS.PC_SWING); if (Anim.GetFloat("State") == 0) { StopCoroutine(CAttack); CAttack = Attack1(); StartCoroutine(CAttack); } else { StopCoroutine(CAttack); StartCoroutine(Attack2()); } }
public override void UseSkill() { Use = false; if (GameManager.Instance.LocalPlayer.Dispenser) { return; } InventoryManager.Instance.GetCogs((int)-price); FX.EffectPlay(FX.SKILLS.TURRET_SET); Dispenser a = Instantiate(_Dispen, GameManager.Instance.LocalPlayer.transform.position, Quaternion.identity).GetComponent <Dispenser>(); a.durability = durability; a.Speed = Speed; a.Damage = Damage; a.Push = Push; a.AttackSpeed = AttackSpeed; }
public override void UseSkill() { Use = false; if (GameManager.Instance.LocalPlayer.ER != GameManager.Instance.LocalPlayer.MAX_ER) { GameManager.Instance.LocalPlayer.ER_UP(UP_ER); } else { return; } GameObject This = Instantiate(Shield, GameManager.Instance.LocalPlayer.transform.position, Quaternion.identity); This.transform.parent = GameManager.Instance.LocalPlayer.transform; FX.EffectPlay(FX.SKILLS.ARMOR); InventoryManager.Instance.GetCogs((int)-price); }
public override void StartAttack() { if (Bullet <= 0 || !CanAttack) { if (Bullet <= 0) { Reloading(); } return; } Bullet--; CanAttack = false; AttackTime = Time.time; Vector2 diff; diff = Controller.MousePosition - transform.GetChild(0).position; diff.Normalize(); float rot_z = (Mathf.Atan2(diff.y, diff.x) * Mathf.Rad2Deg); FX.EffectPlay(FX.PCS.PC_GUNFIRE); Projectile a = Instantiate(Projectile, transform.GetChild(0).position, Quaternion.Euler(0f, 0, rot_z)).GetComponent <Projectile>(); a.MoveSpeed = Speed; a.Damage = ATK * ((100 + Player.ATK) / 100); a.PushValue = PushValue; a.PushPosition = Player.transform.position; if (MaxBullet == 6) { Ammo6.transform.GetChild(Bullet).gameObject.SetActive(false); } else { Ammo9.transform.GetChild(Bullet).gameObject.SetActive(false); } }
//-------------------------------------------------------------------------- // Use this for Check Collider new private void OnTriggerEnter2D(Collider2D collision) { base.OnTriggerEnter2D(collision); if (!_ATTACK) { if (collision.tag == "Obstacle") { _ATTACK = true; Hit(3); if (whatState == 1 && !Boom) { Boom = true; GetComponent <Animator>().SetBool("Boom", true); FX.EffectPlay(FX.ENEMYS.CUCKOO_BOOM); GetComponent <Animator>().SetFloat("BoomLevel", Curse.Bomb_Level); } } else if (collision.tag == "Player") { collision.GetComponent <StateInfo>().Hit(15 * ((100 + ATK) / 100)); if (whatState == 1 && !Boom) { Boom = true; GetComponent <Animator>().SetBool("Boom", true); FX.EffectPlay(FX.ENEMYS.CUCKOO_BOOM); GetComponent <Animator>().SetFloat("BoomLevel", Curse.Bomb_Level); } } } else if (Boom) { if (collision.tag == "Player") { collision.GetComponent <StateInfo>().Hit(15 * ((100 + ATK) / 100)); } } }
// Use this for initialization // Update is called once per frame public override void Update() { if (!Use) { return; } if (Input.GetMouseButtonDown(0)) { InventoryManager.Instance.GetCogs((int)-price); FX.EffectPlay(FX.SKILLS.BOMBBULLET_FIRE); Vector2 diff; diff = GameManager.Instance.InputManager.MousePosition - Gun.transform.GetChild(0).position; diff.Normalize(); float rot_z = (Mathf.Atan2(diff.y, diff.x) * Mathf.Rad2Deg); Projectile a = Instantiate(Projection, Gun.transform.GetChild(0).position, Quaternion.Euler(0f, 0, rot_z)).GetComponent <Projectile>(); a.MoveSpeed = Speed; a.Damage = Damage; a.PushValue = PushValue; a.PushPosition = GameManager.Instance.LocalPlayer.transform.position; Use = false; StartCoroutine(Finish()); GameManager.Instance.MouseCursor.WhatCursor = 0; GameManager.Instance.MouseCursor.SetCursor(); } else if (Input.GetMouseButtonDown(1)) { Use = false; StartCoroutine(Finish()); GameManager.Instance.MouseCursor.WhatCursor = 0; GameManager.Instance.MouseCursor.SetCursor(); } }
IEnumerator AttackCoru() { int Dash_Count = 3; Attach_Wall = false; //FX.EffectPlay(FX.SYSTEMS.ENEMY_READY); GameObject Ready = Instantiate(WaitAttack, transform.position + (Vector3.up * (GetComponent <SpriteRenderer>().size.y / 2 + WaitAttack.GetComponent <SpriteRenderer>().size.y / 2)), Quaternion.identity); Ready.transform.parent = transform; yield return(new WaitForSeconds(1.5f)); Destroy(Ready); GetComponent <Animator>().SetBool("Attack", true); yield return(new WaitForSeconds(0.3f)); while (Dash_Count > 0) { direction = PlayerPosition - transform.position; direction.Normalize(); Vector2 PPosition = transform.position; float PrevTime = Time.time; if (PlayerPosition.x > transform.position.x) { Vector2 diff; diff = PlayerPosition - transform.position; diff.Normalize(); float rot_z = (Mathf.Atan2(diff.y, diff.x) * Mathf.Rad2Deg); transform.localRotation = Quaternion.Euler(0f, 0, rot_z); Front = 1; } else if (PlayerPosition.x <= transform.position.x) { Vector2 diff; diff = (PlayerPosition + (new Vector3(transform.position.x - PlayerPosition.x, 0, 0) * 2)) - transform.position; diff.Normalize(); float rot_z = (Mathf.Atan2(diff.y, diff.x) * Mathf.Rad2Deg); transform.localRotation = Quaternion.Euler(0f, 180, rot_z); Front = -1; } _ATTACK = false; FX.EffectPlay(FX.ENEMYS.HAWK_RUSH); while ((PPosition - new Vector2(transform.position.x, transform.position.y)).magnitude <= AttackDistance && !_ATTACK) { Move(6); if (Attach_Wall) { Attach_Wall = false; break; } yield return(null); } Dash_Count--; _ATTACK = true; yield return(new WaitForSeconds(0.2f)); PlayerPosition = _Player.transform.position; } GetComponent <Animator>().SetBool("Attack", false); if (PlayerPosition.x > transform.position.x) { transform.localRotation = Quaternion.Euler(0, 0, 0); Front = 1; } else if (PlayerPosition.x <= transform.position.x) { transform.localRotation = Quaternion.Euler(0f, 180, 0); Front = -1; } yield return(new WaitForSeconds(2)); AttackTime = Time.time; attack = false; This_State = MON_STATE.IDLE; PrevTime = Time.time; yield return(null); }
public void SOUND() { FX.EffectPlay(FX.ENEMYS.KNIGHT_MOVE); }
public override void UseItem() { FX.EffectPlay(FX.SYSTEMS.SYSTEM_GETITEMS); GameManager.Instance.LocalPlayer.HPUP(value); Destroy(this.gameObject); }
IEnumerator Attack_02() { if (PlayerPosition.x > transform.position.x) { Vector2 diff; diff = PlayerPosition - transform.position; diff.Normalize(); float rot_z = (Mathf.Atan2(diff.y, diff.x) * Mathf.Rad2Deg); transform.localRotation = Quaternion.Euler(0f, 0, rot_z); Front = 1; } else if (PlayerPosition.x <= transform.position.x) { Vector2 diff; diff = (PlayerPosition + (new Vector3(transform.position.x - PlayerPosition.x, 0, 0) * 2)) - transform.position; diff.Normalize(); float rot_z = (Mathf.Atan2(diff.y, diff.x) * Mathf.Rad2Deg); transform.localRotation = Quaternion.Euler(0f, 180, rot_z); Front = -1; } //FX.EffectPlay(FX.SYSTEMS.ENEMY_READY); GameObject Ready = Instantiate(WaitAttack, transform.position + (Vector3.up * (GetComponent <SpriteRenderer>().size.y / 2 + WaitAttack.GetComponent <SpriteRenderer>().size.y / 2)), Quaternion.identity); Ready.transform.parent = transform; yield return(new WaitForSeconds(1)); Destroy(Ready); GetComponent <Animator>().SetBool("Attack", true); //음표 발사 FX.EffectPlay(FX.ENEMYS.CUCKOO_SONG); direction = PlayerPosition - transform.position; direction.Normalize(); Song a = Instantiate(_SONG, transform.position, transform.rotation).GetComponent <Song>(); a.direction = direction; a.ATK = a.ATK * (100 + ATK) / 100; if (Curse.Song_Level >= 1 || Plus >= 1) { a = Instantiate(_SONG, transform.position, transform.rotation * Quaternion.Euler(0, 0, 20)).GetComponent <Song>(); a.direction = direction; a.moveSpeed += 1; a.ATK = a.ATK * (100 + ATK) / 100; a = Instantiate(_SONG, transform.position, transform.rotation * Quaternion.Euler(0, 0, -20)).GetComponent <Song>(); a.direction = direction; a.moveSpeed += 1; a.ATK = a.ATK * (100 + ATK) / 100; } if (Curse.Song_Level >= 2 || Plus >= 2) { a = Instantiate(_SONG, transform.position, transform.rotation * Quaternion.Euler(0, 0, 40)).GetComponent <Song>(); a.direction = direction; a.moveSpeed += 2; a.ATK = a.ATK * (100 + ATK) / 100; a = Instantiate(_SONG, transform.position, transform.rotation * Quaternion.Euler(0, 0, -40)).GetComponent <Song>(); a.direction = direction; a.moveSpeed += 2; a.ATK = a.ATK * (100 + ATK) / 100; } yield return(new WaitForSeconds(0.3f)); if (PlayerPosition.x > transform.position.x) { transform.localRotation = Quaternion.Euler(0, 0, 0); Front = 1; } else if (PlayerPosition.x <= transform.position.x) { transform.localRotation = Quaternion.Euler(0f, 180, 0); Front = -1; } AttackTime = Time.time; attack = false; attacking = false; This_State = MON_STATE.IDLE; PrevTime = Time.time; GetComponent <Animator>().SetBool("Attack", false); }
public override void UseItem() { FX.EffectPlay(FX.SYSTEMS.SYSTEM_GETITEMS); InventoryManager.Instance.GetCogs(value); Destroy(this.gameObject); }