void Update() { if (img != null) { img.sprite = WeaponController.wc.equippedWeapon.sprite; } if (weaponType != null) { weaponType.color = ChooseWeaponNameColor(); weaponType.color = new Color(weaponType.color.r, weaponType.color.g, weaponType.color.b, 0.7f); } if (charge != null) { WeaponController.Weapon.Attack atk = WeaponController.wc.eqWeaponCurAttack; if (atk.chargeTime > 0) { charge.fillAmount = atk.chargeTimer / atk.chargeTime; } else { charge.fillAmount = 0; } } }
void AnimationSummon() { GameObject clone = Instantiate(summon, spawnPoint.position, Quaternion.identity); LivingCreature.Statistics stats = clone.GetComponent <SummonCreature>().stats; WeaponController.Weapon.Attack atk = WeaponController.wc.eqWeaponCurAttack; stats.damage = atk.baseDamage; stats.knockbackPower = atk.knockbackPower; if (atk.crit) { Color swingColor = clone.GetComponent <SpriteRenderer>().color; swingColor = new Color(1f, 0.5f, 0.5f); clone.GetComponent <SpriteRenderer>().color = swingColor; stats.maxHealth = (int)(atk.criticalMultiplier * stats.maxHealth); stats.Initialize(); stats.damage = atk.criticalDamage; } clone.transform.parent = GameObject.Find("PlayerSummons").transform; summons.Add(clone); }
void StartAttack(int _attackNumber) { currentAttackNumber = _attackNumber - 1; WeaponController.wc.currentAttack = currentAttackNumber; WeaponController.Weapon.Attack atk = eqWeapon.attacks[currentAttackNumber]; curAttack = atk; fullyCharged = false; WeaponController.wc.RollCritical(currentAttackNumber); if (curAttack.numberOfHits <= 1) { combo = 0; } if (combo == curAttack.numberOfHits) { combo = 0; } playerAnim.SetFloat("AttackId", (float)atk.animationTypes[combo] / 10f); playerAnim.SetFloat("AttackSpeed", curAttack.attackSpeed); playerAnim.SetBool("BreakCharge", false); playerAnim.SetTrigger("Attack"); }