//Atacks public void WeaponTypeSword(melee m) { sword = m; switch (m) { case melee.BASIC: atkType = "Sword"; atk.GetComponent <BoxCollider2D>().offset = new Vector2(0f, 0f); atk.GetComponent <BoxCollider2D>().size = new Vector2(0.15f, 0.15f); WeaponImg.sprite = meleeWeapon[0]; swordCool = 0.5f; break; case melee.REACH: atkType = "Spear"; atk.GetComponent <BoxCollider2D>().offset = new Vector2(0.1f, 0f); atk.GetComponent <BoxCollider2D>().size = new Vector2(0.3f, 0.1f); WeaponImg.sprite = meleeWeapon[1]; swordCool = 0.25f; break; case melee.BROAD: atkType = "Axe"; atk.GetComponent <BoxCollider2D>().offset = new Vector2(-0.025f, 0.09f); atk.GetComponent <BoxCollider2D>().size = new Vector2(0.2f, 0.4f); WeaponImg.sprite = meleeWeapon[2]; swordCool = 0.75f; break; } }
void Start() { rb = GetComponent <Rigidbody>(); PS = GetComponent <PlayerStat>(); HM = GetComponent <HealthManager>(); Melee = GetComponentInChildren <melee>(); gun = GetComponentInChildren <Gun>(); PL = GetComponentInChildren <PointLight>(); OverKillBar = 0; }
//networking stuff // protected NetworkInstanceId mynetworkID; // Use this for initialization protected virtual void Awake() { // Setup player attributes currentHealth = startingHealth; currentMana = startingMana; myblockController = transform.Find("block").GetComponent<blockController>(); myUltiCamera = GameObject.FindGameObjectWithTag("ultimateCamera").GetComponent<ultimateCameraController>(); mymelee = transform.Find ("melee trigger box").GetComponent<melee> (); myaudio = GetComponent<AudioSource>(); rb = GetComponent<Rigidbody> (); isInUltimate = false; isJumping = false; isAttack = false; isCastMode = false; playBlockAnimation = false; isLose = false; canMove = true; isWalking = false; isPause = false; canCastUltimate = true; isGodMode = false; isUnlimitedSpell = false; isNotEnoughMana = false; isKnockBack = true; isEndOfRangeAttack = true; isFinishCombo = true; isUseHealthItem = false; isUseManaItem = false; isStun = false; isCrouch = false; canCombo = false; shouldWaitAnimationFinish = false; isBlocking = false; isDoubleTap = false; canRangeAttack = true; canMeleeAttack = true; speed = normalSpeed; jumpSpeed = lowJumpSpeed; comboCount = 0; myDamageMultipler = 1.0f;//default highestComboAchieve = 0; blockCount = maxBlockCount; stunRate = 1;//default spellCoolDownRate = 1;//how fast the spell cooldown, 1 is normal rate CurrentChargingBar = Mathf.Clamp01 (CurrentChargingBar); myGameController = GameObject.Find ("gameManager").GetComponent<gameController> (); //coolDownRangeTimer = coolDownRangeAttackRate; coolDownRangeTimer = 0; coolDownMeleeTimer = new float[2]; coolDownMeleeTimer[0] = coolDownMeleeAttackRate; isMeleeComboCount = new bool[3]; for (int i = 0; i < isMeleeComboCount.Length; i++) isMeleeComboCount[i] = false;//for melee combo animation myblockTimer = coolDownBlockTimer; stunTimer = coolDownStunRate; comboText = combo.GetComponent<Text>(); comboAnimation = combo.GetComponent<Animation>(); spellComboArmor = new float[3]; spellComboActive = new float[3]; spellComboPassive = new float[3]; for (int i = 0; i < spellComboArmor.Length; i++) { spellComboArmor[i] = 0; spellComboActive[i] = 0; spellComboPassive[i] = 0; } canCastSpell = new bool[3]; for (int i = 0; i < canCastSpell.Length; i++) canCastSpell[i] = true; StartCoroutine (regenMana (1.0f)); StartCoroutine(regenBlockCount(5.0f)); }
void Start() { meleeScript = GetComponent <melee>(); gunScript = GetComponent <gun>(); }