// Use this for initialization
    protected virtual void Awake()
    {
        mycustomNetworkManager = GameObject.Find("networkController").GetComponent<customNetworkManager>();

        currentHealth = startingHealth;
        currentMana = startingMana;

        playerArrow = transform.Find("arrow parent").gameObject;
        myblockController = transform.Find("block").GetComponent<blockController>();
        myUltiCamera = GameObject.FindGameObjectWithTag("ultimateCamera").GetComponent<ultimateCameraControllerNetwork>();

        mymelee = transform.Find("melee trigger box").GetComponent<meleeNetwork>();
        myaudio = GetComponent<AudioSource>();
        rb = GetComponent<Rigidbody>();

        isJumping = false;
        hasEnterGameOver = false;
        isAttack = false;
        isCastMode = false;
        playBlockAnimation = false;
        isLose = false;
        canMove = true;
        isWalking = false;
        isInResult = false;
        canCastUltimate = true;
        isPSActive = false;
        isPSArmor = false;
        isPSOTU = false;

        armorUICD = false;

         isNotEnoughMana = false;
        isKnockBack = true;
        isEndOfRangeAttack = true;

        isFinishCombo = true;

        isStun = false;
        isCrouch = false;
        canCombo = false;
        shouldWaitAnimationFinish = false;
        isBlocking = false;
        isDoubleTap = false;
        canRangeAttack = true;
        canMeleeAttack = true;

        speed = normalSpeed;
        jumpSpeed = lowJumpSpeed;
           // comboCount = 0;
        highestComboAchieve = 0;
        blockCount = maxBlockCount;
        stunRate = 1;//default
        spellCoolDownRate = 1;//how fast the spell cooldown, 1 is normal rate
        spellCoolDownRateNetwork = spellCoolDownRate;

        myserverLogic = GameObject.Find("server logic(Clone)").GetComponent<serverLogic>();

        coolDownRangeTimer = 0;
        myDamageMultipler = 1;

        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;
    }
Example #2
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));
    }