void OnEnable() { if (speller != null) { rb = GetComponent <Rigidbody2D> (); animator = GetComponent <Animator> (); light = transform.Find("light").gameObject.GetComponent <Light>(); explode_attack = transform.Find("attack").gameObject; explode_attack.SetActive(false); intensity = 4; direction = speller.get_direction(); speed = 4f; Vector2 parent_position = speller.get_position2(); transform.position = new Vector3(parent_position.x + (direction ? 1 : -1) * 0.1f, parent_position.y - 0.1f, transform.position.z); transform.localScale = new Vector2((direction ? -1 : 1), 1); attack attack = gameObject.GetComponent <attack> (); attack.set_attacker(speller); explode_attack.GetComponent <attack> ().set_attacker(speller); life_time = 300; speller.set_scroll_hit(); } }
// Use this for initialization void Start() { attack_effect_anim = this.gameObject.GetComponent <Animator>(); hit_box_collision = hit_box.GetComponent <attack>(); show_effect = this.gameObject.GetComponent <SpriteRenderer>(); show_effect.enabled = false; }
public void takeDamage(attack attack) { float damage = attack.damage; switch (attack.element) { case "fire": damage = damage - ((damage * ((float)_resistance.againstFire / 100.0f)) - damage); break; case "air": damage = damage - ((damage * ((float)_resistance.againstAir / 100.0f)) - damage); break; case "earth": damage = damage - ((damage * ((float)_resistance.againstEarth / 100.0f)) - damage); break; case "water": damage = damage - ((damage * ((float)_resistance.againstWater / 100.0f)) - damage); break; } currentHealth -= damage; }
protected void detect(float move, float cRange, float aRange, attack atk) { //If current animation is not attacking if (currentBaseState.fullPathHash != attackState) { attacking = false; if (dNagi < cRange && health > 0) { //Set player to in combat StartCoroutine(SideChar.combat()); if (dNagi > aRange) { //This enables the walk animation anim.SetFloat("Speed", 1); //Set speed and walk towards palyer float step = movespeed * Time.deltaTime; transform.position = Vector3.MoveTowards(transform.position, target.transform.position, step); } else { //Do attack animation, trigger axe collider etc. atk(); } } else if (dDetect >= cRange && health > 0) { attacking = false; StartCoroutine("Back"); } } }
void Start() { rb = GetComponent <Rigidbody2D>(); sprite = transform.Find("sprite").gameObject; animator = sprite.GetComponent <Animator>(); anime_para_list = new List <int>(); foreach (AnimatorControllerParameter parameter in animator.parameters) { anime_para_list.Add(parameter.nameHash); } foreach (Transform child in transform.Find("skills")) { GameObject child_obj = child.gameObject; skills.Add(child_obj); child.gameObject.SetActive(false); attack attack = child_obj.GetComponent <attack>(); if (attack != null) { attack.set_attacker(this); } } ec = GameObject.Find("effect_controller").GetComponent <effect_controller>(); ac = GameObject.Find("audio_controller").GetComponent <audio_controller>(); sc = GameObject.Find("spell_controller").GetComponent <spell_controller>(); bc = GameObject.Find("buff_controller").GetComponent <buff_controller>(); Start2(); }
// Start is called before the first frame update void Awake() { rbPlayer = this.GetComponent <Rigidbody2D>(); anim = this.GetComponent <Animator>(); attackScript = GetComponent <attack>(); unitsScripts = GetComponent <units>(); speed = walkSpeed; }
void Start() { rb = GetComponent <Rigidbody2D>(); playerPos = FindObjectOfType <attack>(); animator = GetComponent <Animator>(); sprite = GetComponent <SpriteRenderer>(); enemyTransform = GetComponent <Transform>(); }
void Start() { _startCutScene = true; _saveloadButtons.SetActive(false); _mainCam = _mainCamera.GetComponent <ThirdPersonCamera>(); _playerCtrl = _player.GetComponent <playerController>(); _playerAttack = _player.GetComponent <attack>(); //LoadPlayer(); }
void Start() { collision2d_state = GetComponent <collision_state>(); attack_sc = GetComponent <attack>(); Walk = GetComponent <walk_jump>(); anim = GetComponent <Animator>(); }
private void Attack02() { if (Input.GetButtonDown("Fire2")) { currentAttackObject02 = GameObject.Instantiate(attacks[attack02]); currentAttack02 = currentAttackObject02.GetComponent <attack>(); currentAttack02.setCaster(this.gameObject); currentAttack01.Attack(); } }
//--------------------------------------Class Creation----------------------------------------------- public unitType(string namer, int minD, int maxD, int crit, int healthiness, int tank, string animations, attack attack1, attack attack2, attack attack3, attack attack4) { attacks = new attack[10]; name = namer; healthMax = healthiness; armor = tank; minDamage = minD; maxDamage = maxD; attacks[0] = attack1; attacks[1] = attack2; attacks[2] = attack3; attacks[3] = attack4; animator = animations; }
//public GameObject singleTargetProjectile; public void fire(List <invader> invader, attack attack, Transform origin, GameObject appearance) { if (invader.Count >= 1) { if (invader[0].gameObject.activeInHierarchy) { GameObject newProjectile = Instantiate(appearance, new Vector2(origin.position.x, origin.position.y), Quaternion.identity) as GameObject; projectiles projectile = newProjectile.GetComponent <projectiles>(); projectile.target = invader[0].transform; projectile.attack = attack; } } }
public IEnumerator RangerSpearFlurry(GameObject prefab) { float rotation = 0; if (direction == Vector2.left) { rotation = 180; } if (direction == Vector2.up) { rotation = 90; } if (direction == Vector2.down) { rotation = 270; } FindObjectOfType <AudioManager>().PlaySound("Throw"); GetComponent <Animator>().SetTrigger("Shoot"); GameObject Spear1 = Instantiate(prefab, rb2D.position + direction * 3f, Quaternion.Euler(new Vector3(0, 0, rotation))); attack projectile1 = Spear1.GetComponent <attack>(); projectile1.damage = 20f; projectile1.life = 5; projectile1.speed = 1600; projectile1.Throw(direction); yield return(new WaitForSeconds(0.3f)); FindObjectOfType <AudioManager>().PlaySound("Throw"); GetComponent <Animator>().SetTrigger("Shoot"); GameObject Spear2 = Instantiate(prefab, rb2D.position + direction * 3f, Quaternion.Euler(new Vector3(0, 0, rotation))); attack projectile2 = Spear2.GetComponent <attack>(); projectile2.damage = 20f; projectile2.life = 5; projectile2.speed = 1600; projectile2.Throw(direction); yield return(new WaitForSeconds(0.3f)); FindObjectOfType <AudioManager>().PlaySound("Throw"); GetComponent <Animator>().SetTrigger("Shoot"); GameObject Spear3 = Instantiate(prefab, rb2D.position + direction * 3f, Quaternion.Euler(new Vector3(0, 0, rotation))); attack projectile3 = Spear3.GetComponent <attack>(); projectile3.damage = 20f; projectile3.life = 5; projectile3.speed = 1600; projectile3.Throw(direction); }
public attack(attack a) { moveList = new List<movement>(); loops = a.loops; extraDamagePerChargeLevel = a.extraDamagePerChargeLevel; movementMult = a.movementMult; turnMult = a.turnMult; staminaDrain = a.staminaDrain; for (int i = 0; i < a.moveList.Count; i++) { movement m = new movement(a.moveList[i]); moveList.Add(m); } }
void OnEnable() { if (speller != null) { direction2 = direction2.normalized; rb = GetComponent <Rigidbody2D> (); sr = GetComponent <SpriteRenderer> (); speed = 15f; Vector2 parent_position = speller.get_position2(); transform.position = new Vector3(parent_position.x + (direction2.x > 0 ? 1 : -1) * 0.2f, parent_position.y - 0.1f + (-0.1f * Random.value), transform.position.z); attack attack = gameObject.GetComponent <attack> (); attack.set_attacker(speller); dead_time = 200; } }
private void InitializeEntries(UInt32 entryCount, BinaryReader binReader) { attacks = new attack[entryCount]; for (Int32 i = 0; i < entryCount; i++) { attacks[i] = new attack(); attacks[i].subaction = util.ReadReverseUInt16(binReader); binReader.BaseStream.Position += 0x2;//padding attacks[i].start = util.ReadReverseUInt16(binReader); attacks[i].end = util.ReadReverseUInt16(binReader); attacks[i].x1 = util.ReadReverseFloat(binReader); attacks[i].x2 = util.ReadReverseFloat(binReader); attacks[i].y1 = util.ReadReverseFloat(binReader); attacks[i].y2 = util.ReadReverseFloat(binReader); } }
void OnEnable() { if (speller != null) { Vector2 parent_position = speller.get_position2(); bool speller_direction = speller.get_direction(); transform.position = new Vector3(parent_position.x + (speller_direction ? 1 : -1) * 0.35f, parent_position.y + (-0.1f - 0.05f * Random.value), -5); transform.localScale = new Vector2((speller_direction ? 1 : -1), 1); transform.parent = speller.transform; attack attack = gameObject.GetComponent <attack> (); attack.set_attacker(speller); animator = GetComponent <Animator> (); inited = true; time_full = 300; } }
void loadClasses() { Classes = new unitType[10]; healths = new int[10]; armors = new int[10]; mins = new int[10]; maxs = new int[10]; speeds = new int[10]; crits = new int[10]; classNames = new string[10]; spriteSheets = new string[10]; attackID = new int[10]; Debug.Log(Classlist.text); string[] data = Classlist.text.Split(new char[] { '\n' }); for (int i = 1; i < data.Length - 1; i++) { string[] ClassRow = data[i].Split(new char[] { ',' }); classNames[i] = ClassRow[1]; int.TryParse(ClassRow[2], out maxs[i]); int.TryParse(ClassRow[3], out mins[i]); int.TryParse(ClassRow[4], out crits[i]); int.TryParse(ClassRow[5], out healths[i]); int.TryParse(ClassRow[6], out armors[i]); spriteSheets[i] = ClassRow[7]; int.TryParse(ClassRow[8], out attackID[i]); attacks = new attack[4]; string[] attackRow = AttackSheet.text.Split(new char[] { '\n' }); for (int p = 0; p < 4; p++) { string[] attackData = attackRow[p + 2 + 5 * attackID[i]].Split(new char[] { ',' }); validTargets = new int[4]; string attackName = attackData[1]; int.TryParse(attackData[2], out type); int.TryParse(attackData[3], out damageMod); int.TryParse(attackData[4], out accuracy); int.TryParse(attackData[5], out stun); for (int o = 0; o < 4; o++) { int.TryParse(attackData[6 + o], out validTargets[o]); } attacks[p] = new attack(attackName, type, damageMod, accuracy, stun, validTargets[0], validTargets[1], validTargets[2], validTargets[3]); } Classes[i - 1] = new unitType(classNames[i], mins[i], maxs[i], crits[i], healths[i], armors[i], spriteSheets[i], attacks[0], attacks[1], attacks[2], attacks[3]); } }
void OnEnable() { if (speller != null) { animator = GetComponent <Animator> (); transform.position = new Vector3(direction2.x, direction2.y, transform.position.z); foreach (Transform child in transform.Find("skills")) { GameObject child_obj = child.gameObject; child.gameObject.SetActive(false); skills.Add(child_obj); attack attack = child_obj.GetComponent <attack>(); if (attack != null) { attack.set_attacker(speller); } } } }
public void fire(List <invader> invader, attack attack) { for (int index = 0; index < invader.Count; ++index) { if (invader[index].gameObject.activeInHierarchy) { invader[index].health.takeDamage(attack); } else { invader.RemoveAt(index); continue; } if (invader[index].health.isDead()) { invader.RemoveAt(index); } } }
void OnEnable() { if (speller != null) { time_max = 50; time_now = 0; is_front = true; is_dead = false; animator = GetComponent <Animator> (); attack attack = gameObject.GetComponent <attack> (); attack.set_attacker(speller); intensity = 4; light = transform.Find("light").gameObject.GetComponent <Light>(); Vector2 position_center = speller.get_position2(); transform.position = new Vector3(position_center.x, position_center.y - 0.08f, (is_front ? -0.01f : 0.01f)); gameObject.GetComponent <TrailRenderer> ().enabled = true; DontDestroyOnLoad(gameObject); } }
public attack_data(uint cmn_subs, uint spc_subs, string attackDir) { common_subactions = cmn_subs; special_subactions = spc_subs; CustomStringReader sReader = new CustomStringReader(File.ReadAllText(attackDir), "attack_data.txt"); try { List <attack> atks = new List <attack>(); while (true) { attack atk = new attack(); string subactionStr = sReader.ReadWord(); if (subactionStr == null) { break; } atk.subaction = ushort.Parse(subactionStr); sReader.ReadUntilAnyOfChars("[", true); atk.start = ushort.Parse(sReader.ReadWord()); sReader.ReadUntilAnyOfChars(",", true); atk.end = ushort.Parse(sReader.ReadWord()); sReader.ReadUntilAnyOfChars("[", true); atk.x1 = float.Parse(sReader.ReadWord()); sReader.ReadUntilAnyOfChars(",", true); atk.x2 = float.Parse(sReader.ReadWord()); sReader.ReadUntilAnyOfChars(",", true); atk.y1 = float.Parse(sReader.ReadWord()); sReader.ReadUntilAnyOfChars(",", true); atk.y2 = float.Parse(sReader.ReadWord()); sReader.SkipToEndLine(); atks.Add(atk); } attacks = atks.ToArray(); count = (uint)attacks.Length; } catch (Exception e) { throw new Exception(sReader.ExceptionMsg(e.Message), e); } }
void OnEnable() { if (speller != null) { rb = GetComponent <Rigidbody2D> (); explode_attack = transform.Find("attack").gameObject; explode_attack.SetActive(false); direction = speller.get_direction(); speed = 3f; Vector2 parent_position = speller.get_position2(); transform.position = new Vector3(parent_position.x + (direction ? 1 : -1) * 0.4f, parent_position.y - 0.05f, transform.position.z); transform.localScale = new Vector2((direction ? 1 : -1), 1); attack attack = gameObject.GetComponent <attack> (); attack.set_attacker(speller); explode_attack.GetComponent <attack> ().set_attacker(speller); life_time = 200; } }
void attackSelect(int choice) { if (choice == 0) { Attack = attack.THROW; } else if (choice == 1) { Attack = attack.POUND; } else if (choice == 2) { Attack = attack.SWING; } else if (choice == 3) { Attack = attack.JUMP; } else if (choice == 4) { Attack = attack.NOTHING; } }
public IEnumerator RangerHeavansFlurry(GameObject prefab) { float rotation = 270; Vector2 off = new Vector2(8, 6f); if (direction == Vector2.left) { off = new Vector2(-8, 6f); } Vector3 tempP = rb2D.position + off + direction * 3f; GameObject Arrow1 = Instantiate(prefab, tempP, Quaternion.Euler(new Vector3(0, 0, rotation))); attack projectile1 = Arrow1.GetComponent <attack>(); projectile1.damage = 10f; projectile1.life = 1000f; projectile1.speed = 500; projectile1.Launch(Vector2.down); yield return(new WaitForSeconds(0.4f)); GameObject Arrow2 = Instantiate(prefab, tempP, Quaternion.Euler(new Vector3(0, 0, rotation))); attack projectile2 = Arrow2.GetComponent <attack>(); projectile2.damage = 10f; projectile2.life = 1000f; projectile2.speed = 500; projectile2.Launch(Vector2.down); yield return(new WaitForSeconds(0.4f)); GameObject Arrow3 = Instantiate(prefab, tempP, Quaternion.Euler(new Vector3(0, 0, rotation))); attack projectile3 = Arrow3.GetComponent <attack>(); projectile3.damage = 10.5f; projectile3.life = 1000f; projectile3.speed = 500; projectile3.Launch(Vector2.down); yield return(new WaitForSeconds(0.4f)); GameObject Arrow4 = Instantiate(prefab, tempP, Quaternion.Euler(new Vector3(0, 0, rotation))); attack projectile4 = Arrow4.GetComponent <attack>(); projectile4.damage = 10.5f; projectile4.life = 1000f; projectile4.speed = 500; projectile4.Launch(Vector2.down); yield return(new WaitForSeconds(0.4f)); GameObject Arrow5 = Instantiate(prefab, tempP, Quaternion.Euler(new Vector3(0, 0, rotation))); attack projectile5 = Arrow5.GetComponent <attack>(); projectile5.damage = 10.5f; projectile5.life = 1000f; projectile5.speed = 500; projectile5.Launch(Vector2.down); yield return(new WaitForSeconds(0.4f)); GameObject Arrow6 = Instantiate(prefab, tempP, Quaternion.Euler(new Vector3(0, 0, rotation))); attack projectile6 = Arrow6.GetComponent <attack>(); projectile6.damage = 10.5f; projectile6.life = 1000f; projectile6.speed = 500; projectile6.Launch(Vector2.down); yield return(new WaitForSeconds(0.4f)); GameObject Arrow7 = Instantiate(prefab, tempP, Quaternion.Euler(new Vector3(0, 0, rotation))); attack projectile7 = Arrow7.GetComponent <attack>(); projectile7.damage = 10.5f; projectile7.life = 1000f; projectile7.speed = 500; projectile7.Launch(Vector2.down); yield return(new WaitForSeconds(0.4f)); GameObject Arrow8 = Instantiate(prefab, tempP, Quaternion.Euler(new Vector3(0, 0, rotation))); attack projectile8 = Arrow8.GetComponent <attack>(); projectile8.damage = 10.5f; projectile8.life = 1000f; projectile8.speed = 500; projectile8.Launch(Vector2.down); yield return(new WaitForSeconds(0.4f)); GameObject Arrow9 = Instantiate(prefab, tempP, Quaternion.Euler(new Vector3(0, 0, rotation))); attack projectile9 = Arrow9.GetComponent <attack>(); projectile9.damage = 10.5f; projectile9.life = 1000f; projectile9.speed = 500; projectile9.Launch(Vector2.down); yield return(new WaitForSeconds(0.4f)); GameObject Arrow10 = Instantiate(prefab, tempP, Quaternion.Euler(new Vector3(0, 0, rotation))); attack projectile10 = Arrow10.GetComponent <attack>(); projectile10.damage = 10.5f; projectile10.life = 1000f; projectile10.speed = 500; projectile10.Launch(Vector2.down); }
// Update is called once per frame void Update() { hit_attack = GetComponentInChildren <attack>(); Movement(); float x_input_temp = Mathf.Abs(x_input); float y_input_temp = Mathf.Abs(y_input); if (x_input_temp >= y_input_temp) { move_anim = Mathf.Abs(x_input_temp); } else if (y_input_temp > x_input_temp) { move_anim = Mathf.Abs(y_input_temp); } n_animator.SetFloat("Speed", move_anim); if (Input.GetKeyDown("q") && !isJumping) { attacking_combo(); } else if (Input.GetKeyDown("q") && isJumping) { n_animator.SetInteger("Jump", 3); Debug.Log("jump_kick"); } hit_combo_count(); if (punch > 0 && n_animator.GetCurrentAnimatorStateInfo(0).normalizedTime > 0.4f && hit_attack.enemy_hit) { //shake = true; if (shake == 0) { shake = 1; } } else if (hit_attack.enemy_hit && isJumping) { if (shake == 0) { shake = 1; jump_stop = transform.position; } } if (shake == 1) { if (isJumpkick == false) { body_shake(); } } if (shake >= 1) { combo_time += Time.deltaTime; if (combo_time > 0.18f) { combo_time = 0.0f; shake = 0; } } }
void Start() { rb = GetComponent <Rigidbody2D>(); playerPos = FindObjectOfType <attack>(); attacj = FindObjectOfType <attack>(); }
// Update is called once per frame void Update() { hit_attack = GetComponentInChildren <attack>(); float x_input_temp = Mathf.Abs(x_input); float y_input_temp = Mathf.Abs(y_input); if (x_input_temp >= y_input_temp) { move_anim = Mathf.Abs(x_input_temp); } else if (y_input_temp > x_input_temp) { move_anim = Mathf.Abs(y_input_temp); } n_animator.SetFloat("Speed", move_anim); if (hit_combo == 0) { Movement_controller(); } if (Input.GetKeyDown("q") && !isJumping) { attacking_combo(); } else if (Input.GetKey(KeyCode.Space) && !isJumping && punch == 0 && !after_jump) { axisY = transform.position.y; isJumping = true; rigidbody_j.gravityScale = 2.0f; rigidbody_j.WakeUp(); rigidbody_j.AddForce(new Vector2(100.0f * x_input, jumpforce)); n_animator.SetInteger("Jump", 1); Debug.Log("jump 1!!"); } else if (Input.GetKeyDown("q") && isJumping) { n_animator.SetInteger("Jump", 3); Debug.Log("jump_kick"); } hit_combo_count(); if (n_animator.GetCurrentAnimatorStateInfo(0).IsName("idle")) { hit_combo = 0; } if (punch > 0 && n_animator.GetCurrentAnimatorStateInfo(0).normalizedTime > 0.4f && hit_attack.enemy_hit) { //shake = true; if (shake == 0) { shake = 1; } } else if (hit_attack.enemy_hit && isJumping) { if (shake == 0) { shake = 1; jump_stop = transform.position; } } if (shake == 1) { if (isJumpkick == false) { if (!n_animator.GetCurrentAnimatorStateInfo(0).IsName("idle")) { body_shake(); } } //when you press combo and press space at the same time, there is a bug } if (shake >= 1) { combo_time += Time.deltaTime; if (combo_time > 0.18f) { combo_time = 0.0f; shake = 0; shake_time = 0; n_animator.speed = 1.0f; shaking = false; isJumpkick = false; } } if (after_jump == true) { jump_delay += Time.deltaTime; if (jump_delay > 0.2f) { after_jump = false; jump_delay = 0.0f; } } }
void OnTriggerEnter2D(Collider2D collider) { attack attack = collider.gameObject.GetComponent <attack> (); charactor attacker = attack.get_attacker(); if (attacker == bearer) { return; } if (!attack.is_valid()) { return; } if (!bearer.get_is_attackable()) { return; } //flag only one hit attack attack.attacked(); float position_x = bearer.transform.position.x - attacker.transform.position.x; bearer.set_direction(position_x < 0); Vector2 derection = transform.position - attacker.transform.position; rb.velocity = new Vector2((attack.beatback_damage * (derection.x > 0 ? 1 : -1)), rb.velocity.y); //floating if (attack.is_ground_floating || bearer.get_in_air()) { rb.velocity = new Vector2(rb.velocity.x, attack.floating_damage); } attacker.add_speed(attack.self_beatback_damage * (position_x < 0 ? 1 : -1), attack.self_floating_damage); bearer.set_hp(bearer.hp_now - attack.damage); bc.create_buff(1, attacker, bearer, attack.stun, attack.frame_extract); //face to attacker bearer.set_last_attacked(attacker); attacker.set_last_attack(bearer); attacker.hit_message(attack); bearer.hitted_message(attack); //frame_extract bc.create_buff(3, bearer, bearer, Mathf.Max(attack.frame_extract, 1), 0); if (attack.is_melee) { bc.create_buff(3, attacker, attacker, attack.frame_extract, 0); } //effect ec.create_effect(1, false, parent, new Vector2(0, 0), bearer, attack.frame_extract); if (attack.damage > 8) { ec.create_effect(2, (Random.value > 0.5f), parent, new Vector2(0, 0), bearer, 0); } else { ec.create_effect(14, (Random.value > 0.5f), parent, new Vector2(0, 0), bearer, 0); } //ec.create_effect (5, bearer.get_direction(), parent, new Vector2(0,0), bearer, 0); if (attack.attack_kind == 0) { ec.create_effect(10, !bearer.get_direction(), parent, new Vector2((bearer.get_direction() ? -1 : 1) * (Random.value * 0.1f - 0.05f + 0.1f), Random.value * 0.1f - 0.12f), bearer, 0, attack.attack_direction); } if (attacker.is_player) { if (attack.frame_extract > 5) { if (Mathf.Abs(attack.attack_direction.x) >= Mathf.Abs(attack.attack_direction.y)) { player.set_camera_shaking_code(attack.frame_extract * 10 + 1); } else { if (attack.attack_direction.y > 0) { player.set_camera_shaking_code(attack.frame_extract * 10 + 2); } else { player.set_camera_shaking_code(attack.frame_extract * 10 + 3); } } } } //stun bc.create_buff(100, bearer, bearer, 10, 0); //audio ac.create_audio((Random.value > 0.5f ? 1 : 2), attack.frame_extract); }
public void hitted_message(attack attack) { hitted_message2(attack); is_hitted = true; is_stun = true; }
public void hit_message(attack attack) { hit_message2(attack); }
// Use this for initialization void Start() { _camera = Camera.main; screenWidth = _camera.pixelWidth; screenHeight = _camera.pixelHeight; for (int i=0; i<4; i++) { mattack[i]=new attack(); mskill[i]=new skill(); } mattack [0].changeOnOff (); mattack [0].setAttackrange (0, 1); mattack [0].setAttackvalue (100); }
public virtual void hitted_message2(attack attack) { }
public void DoLightChargingEffect(attack a) { if (chargeLight == null) return; if (a.chargeLevel == 0) { chargeLight.range = 0; //emit.Stop(); return; } float cfrac = a.chargeLevel / 4f; float range = a.chargeLevel * 4f + 2; float intensity = cfrac * 1f + 0.5f; chargeLight.range = range; chargeLight.color = GetChargeCol(a.chargeLevel); chargeLight.intensity = intensity * 2; /*if (!emit.isPlaying) emit.Emit(1); emit.startColor = GetChargeCol(a.chargeLevel); ParticleSystem.Particle[] parts = new ParticleSystem.Particle[emit.particleCount]; emit.GetParticles(parts); for(int i=0; i<parts.Length; i++) { Vector4 col = GetChargeCol(a.chargeLevel); parts[i].startColor = new Color(col.x, col.y, col.z); } emit.SetParticles(parts, parts.Length);*/ billboard.SetActive(true); billboard.GetComponent<Renderer>().material.color = GetChargeCol(a.chargeLevel); //UpdateBillboard(); }
// Update is called once per frame void Update() { billboard.SetActive(false); bool lclick = Input.GetMouseButtonDown(0); bool lheld = Input.GetMouseButton(0); if (attackList.Count == 0 && lclick) { if(staminaManager.canDoStaminaAction()) { attack atk = new attack(MH1); attackList.Add(atk); damage.ResetHit(); staminaManager.depleteBulk(atk.staminaDrain); } } if(attackList.Count == 0) { chargeLight.range = 0; //emit.Stop(); } for(int i=0; i<attackList.Count; i++) { Quaternion Q = attackList[i].tick(Time.deltaTime, lheld, chargeup.moveList[0]); swordTransform.localRotation = Q; DoLightChargingEffect(attackList[i]); if(attackList[i].isFinished()) { attackList.RemoveAt(i); i--; } staminaManager.pause(); } activateColliderIfDamaging(); UpdateBillboard(); }