/*
     * AnimStates
     * 0 = idle
     * 1 = Walk
     * 2 = Attack
     * 3= Jump
     * 4 = GetHurt
     * 5= Death
     */
    void Update()
    {
        attacknum = Mathf.Clamp(attacknum, 0, attackNumMax);

        if (altBuild)
        {
            meleeMat.color = Color.HSVToRGB(.016f, .788f, .5f);
        }
        else
        {
            meleeMat.color = Color.HSVToRGB(.016f, .788f, .95f);
        }
        anim.SetInteger("AnimState", 0);
        timer += Time.deltaTime;
        if (timer > speedReset)
        {
            attacknum = 0;
        }

        // colliders is for grounding the player, for jumping purposes.
        colliders = Physics.OverlapCapsule(transform.position, transform.position - (Vector3.up * .01f), .25f, groundMask, QueryTriggerInteraction.Ignore);
        h1        = health.health;
        #region Controls
        if (walkspeed >= 0 && CTRLID != 0 && !health.isDead)
        {
            playermovement = new Vector3(Input.GetAxis("J" + CTRLID + "Horizontal"), 0, Input.GetAxis("J" + CTRLID + "Vertical"));
            if (playermovement != Vector3.zero)
            {
                transform.rotation = Quaternion.LookRotation(playermovement);
                transform.Translate(playermovement * walkspeed * Time.deltaTime, Space.World);
                anim.SetInteger("AnimState", 1);
            }
            else
            {
            }
        }

        if (CTRLID != 0 && colliders.Length > 0 && Input.GetKeyDown("joystick " + CTRLID + " button 0") && !health.isDead)
        {
            abilities.Jump(CTRLID, gameObject, jumpHeight);
            anim.SetInteger("AnimState", 3);
        }
        else
        {
        }

        if (CTRLID != 0 && Input.GetKey("joystick " + CTRLID + " button 3") && !health.isDead)
        {
            timer1 += Time.deltaTime;
            if (timer1 > reviveCastTime)
            {
                abilities.Revive(1, gameObject, reviveRadius);
            }
        }
        if (CTRLID != 0 && Input.GetKeyUp("joystick " + CTRLID + " button 3") && !health.isDead)
        {
            reviveCastTime = 0;
        }

        if (CTRLID != 0 && Input.GetKeyDown("joystick " + CTRLID + " button 1") && cooldowns.activeCooldowns[8] <= 0 && altBuild && !health.isDead)
        {
            abilities.MeleeLunge(lungeDamage, 2, gameObject, lungeCD, lungeDistance);
        }

        if (CTRLID != 0 && Input.GetKeyDown("joystick " + CTRLID + " button 1") && cooldowns.activeCooldowns[7] <= 0 && !altBuild && !health.isDead)
        {
            abilities.Whirlwind(whirlwindDamage, 2, gameObject, cycloneCD, strikeInterval);
        }

        if (CTRLID != 0 && Input.GetKeyDown("joystick " + CTRLID + " button 2") && cooldowns.activeCooldowns[6] <= 0 && !health.isDead)
        {
            visual = true;
            GetComponent <MeleeVisualization>().OnBool(visual);
        }

        if (CTRLID != 0 && Input.GetKeyUp("joystick " + CTRLID + " button 2") && cooldowns.activeCooldowns[6] <= 0 && !altBuild && !health.isDead)
        {
            visual = false;
            GetComponent <MeleeVisualization>().OnBool(visual);
            attacknum++;
            if (hitbox.GetComponent <MeleeTargetList>().mTar.Count > 0)
            {
                timer = 0;
            }
            abilities.MeleeStrikeBerserker(berserkerMeleeDamage, 2, gameObject, hitbox.GetComponent <MeleeTargetList>().mTar, attacknum, berserkerMeleeAttackCD, attackNumMax, speedInterval);
            anim.SetInteger("AnimState", 2);
        }
        else
        {
        }

        if (CTRLID != 0 && Input.GetKeyUp("joystick " + CTRLID + " button 2") && cooldowns.activeCooldowns[6] <= 0 && altBuild && !health.isDead)
        {
            visual = false;
            GetComponent <MeleeVisualization>().OnBool(visual);
            //attacknum++;
            if (hitbox.GetComponent <MeleeTargetList>().mTar.Count > 0)
            {
                timer = 0;
            }
            abilities.MeleeStrikeRogue(rogueMeleeDamage, 2, gameObject, hitbox.GetComponent <MeleeTargetList>().mTar, attacknum, rogueMeleeAttackCD);
            anim.SetInteger("AnimState", 2);
        }
        else
        {
        }

        if (CTRLID != 0 && Input.GetKeyDown("joystick " + CTRLID + " button 5"))
        {
            altBuild = !altBuild;
        }

        #endregion
        #region Health and Death
        if (h1 < h2)
        {
            meleeMat.SetColor("_EmissionColor", Color.HSVToRGB(1f, 1, 1));

            anim.SetInteger("AnimState", 4);
            h2 = h1;
        }
        else
        {
            meleeMat.SetColor("_EmissionColor", Color.HSVToRGB(1f, 1, 0));
        }

        if (health.isDead)
        {
            anim.SetInteger("AnimState", 5);
            walkspeed       = 0;
            playermovement *= 0;
        }
        else
        {
            walkspeed = 10;
        }
        #endregion
    }
Beispiel #2
0
    /*
     * AnimStates
     * 0 = idle
     * 1 = Walk
     * 2 = Attack
     * 3= Jump
     * 4 = GetHurt
     * 5= Death
     */
    void Update()
    {
        if (altBuild)
        {
            tankMat.color = Color.HSVToRGB(.613f, .537f, .4f);
        }
        else if (!altBuild)
        {
            tankMat.color = Color.HSVToRGB(.613f, .537f, .82f);
        }
        anim.SetInteger("AnimState", 0);

        // colliders is for grounding the player, for jumping purposes.
        colliders = Physics.OverlapCapsule(transform.position, transform.position - (Vector3.up * .1f), .25f, groundMask, QueryTriggerInteraction.Ignore);
        h1        = health.health;
        #region Controls
        if (walkspeed >= 0 && CTRLID != 0 && !health.isDead)
        {
            playermovement = new Vector3(Input.GetAxis("J" + CTRLID + "Horizontal"), 0, Input.GetAxis("J" + CTRLID + "Vertical"));
            //Vector3 relpos = playermovement - transform.position;
            if (playermovement != Vector3.zero)
            {
                if (Input.GetKey("joystick " + CTRLID + " button 1") && cooldowns.activeCooldowns[0] <= 0 && !altBuild)
                {
                    transform.rotation = transform.rotation;
                }
                else
                {
                    transform.rotation = Quaternion.LookRotation(playermovement);
                }
                transform.Translate(playermovement * walkspeed * Time.deltaTime, Space.World);
                anim.SetInteger("AnimState", 1);
            }
            else
            {
            }
        }

        if (CTRLID != 0 && colliders.Length > 0 && Input.GetKeyDown("joystick " + CTRLID + " button 0"))
        {
            abilities.Jump(CTRLID, gameObject, jumpHeight);
            anim.SetInteger("AnimState", 3);
        }
        else
        {
        }

        if (CTRLID != 0 && Input.GetKey("joystick " + CTRLID + " button 3") && !health.isDead)
        {
            timer1 += Time.deltaTime;
            if (timer1 > reviveCastTime)
            {
                abilities.Revive(1, gameObject, reviveRadius);
            }
        }
        if (CTRLID != 0 && Input.GetKeyUp("joystick " + CTRLID + " button 3") && !health.isDead)
        {
            reviveCastTime = 0;
        }

        if (CTRLID != 0 && Input.GetKey("joystick " + CTRLID + " button 1") && cooldowns.activeCooldowns[0] <= 0 && !altBuild && !health.isDead)
        {
            GameObject cap = GameObject.CreatePrimitive(PrimitiveType.Capsule);
            Destroy(cap.GetComponent <CapsuleCollider>());
            cap.transform.position   = transform.position + transform.forward * 10;
            cap.transform.rotation   = transform.rotation * Quaternion.Euler(90, 0, 0);
            cap.transform.localScale = new Vector3(1, 10, 1);
            cap.transform.parent     = transform;
            Destroy(cap, Time.deltaTime + .002f);


            abilities.TankMagnet(magnetThreat, 0, gameObject, magnetCooldown, magnetMask, magnetDistance, pullSpeed);
            anim.SetInteger("AnimState", 2);
            tankMat.SetColor("_EmissionColor", Color.HSVToRGB(.7f, 1, 1));
        }
        else
        {
            tankMat.SetColor("_EmissionColor", Color.HSVToRGB(.7f, 1, 0));
        }
        if (CTRLID != 0 && Input.GetKeyUp("joystick " + CTRLID + " button 1") && !altBuild && !health.isDead)
        {
            cooldowns.triggerCooldown(0, magnetCooldown);
        }

        if (CTRLID != 0 && Input.GetKeyDown("joystick " + CTRLID + " button 2") && cooldowns.activeCooldowns[1] <= 0 && altBuild && !health.isDead)
        {
            abilities.TankPerfectShield(shieldHealth, 0, gameObject, perfectShieldCooldown, perfectShieldDuration, dodgeRadius);
            anim.SetInteger("AnimState", 2);
        }

        if (CTRLID != 0 && Input.GetKeyDown("joystick " + CTRLID + " button 2") && cooldowns.activeCooldowns[1] <= 0 && !altBuild && !health.isDead)
        {
            abilities.TankShield(shieldHealth, 0, gameObject, shieldCooldown, shieldDuration, InfiniteShield, shieldSize);
            anim.SetInteger("AnimState", 2);
        }



        if (CTRLID != 0 && Input.GetKey("joystick " + CTRLID + " button 1") && cooldowns.activeCooldowns[0] <= 0 && altBuild && !health.isDead)
        {
            //timer += Time.deltaTime;
            //reflectDamage += (h2 - h1) * 2;
            abilities.TankReflect(reflectDamage, 0, gameObject, reflectCooldown, true, h1, h2, timer, reflectDistance, beamWidth, damageMultiplier);
            tankMat.SetColor("_EmissionColor", Color.HSVToRGB(.5f, 1, 1));
            //if (timer > 2)
            //{
            //    timer = 0;
            //    reflectDamage = 0;
            //}
        }
        if (CTRLID != 0 && Input.GetKeyUp("joystick " + CTRLID + " button 1") && cooldowns.activeCooldowns[0] <= 0 && altBuild && !health.isDead)
        {
            tankMat.SetColor("_EmissionColor", Color.HSVToRGB(.5f, 1, 0));
            cooldowns.triggerCooldown(0, reflectCooldown);

            //timer = 0;
            //reflectDamage = 0;
        }



        if (CTRLID != 0 && Input.GetKeyDown("joystick " + CTRLID + " button 5"))
        {
            altBuild = !altBuild;
        }
        #endregion
        #region Health and Death
        if (h1 < h2)
        {
            tankMat.SetColor("_EmissionColor", Color.HSVToRGB(1, 1, 1));
            anim.SetInteger("AnimState", 4);
            h2 = h1;
        }
        else if (tankMat.GetColor("_EmissionColor") != Color.HSVToRGB(1, 1, 0) && !Input.GetKey("joystick " + CTRLID + " button 1"))
        {
            tankMat.SetColor("_EmissionColor", Color.HSVToRGB(1, 1, 0));
        }

        if (health.isDead)
        {
            anim.SetInteger("AnimState", 5);
            walkspeed       = 0;
            playermovement *= 0;
        }
        else
        {
            walkspeed = 10;
        }

        #endregion
    }
Beispiel #3
0
    /*
     * AnimStates
     * 0 = idle
     * 1 = Walk
     * 2 = Attack
     * 3= Jump
     * 4 = GetHurt
     * 5= Death
     */
    void Update()
    {
        if (altBuild)
        {
            rangedMat.color = Color.HSVToRGB(.216f, .6f, .2f);
        }
        else
        {
            rangedMat.color = Color.HSVToRGB(.216f, .6f, .48f);
        }
        anim.SetInteger("AnimState", 0);

        // colliders is for grounding the player, for jumping purposes.
        colliders = Physics.OverlapCapsule(transform.position, transform.position - (Vector3.up * .1f), .25f, groundMask, QueryTriggerInteraction.Ignore);
        h1        = health.health;
        #region Controls
        if (walkspeed >= 0 && CTRLID != 0 && !health.isDead)
        {
            playermovement = new Vector3(Input.GetAxis("J" + CTRLID + "Horizontal"), 0, Input.GetAxis("J" + CTRLID + "Vertical"));
            if (playermovement != Vector3.zero)
            {
                transform.rotation = Quaternion.LookRotation(playermovement);
                transform.Translate(playermovement * walkspeed * Time.deltaTime, Space.World);
                anim.SetInteger("AnimState", 1);
            }
            else
            {
            }
        }


        if (CTRLID != 0 && colliders.Length > 0 && Input.GetKeyDown("joystick " + CTRLID + " button 0") && !health.isDead)
        {
            abilities.Jump(CTRLID, gameObject, jumpHeight);
            anim.SetInteger("AnimState", 3);
        }
        else
        {
        }

        if (CTRLID != 0 && Input.GetKey("joystick " + CTRLID + " button 3") && !health.isDead)
        {
            timer1 += Time.deltaTime;
            if (timer1 > reviveCastTime)
            {
                abilities.Revive(1, gameObject, reviveRadius);
            }
        }
        if (CTRLID != 0 && Input.GetKeyUp("joystick " + CTRLID + " button 3") && !health.isDead)
        {
            reviveCastTime = 0;
        }

        if (CTRLID != 0 && Input.GetKeyDown("joystick " + CTRLID + " button 1") && cooldowns.activeCooldowns[11] <= 0 && altBuild && !health.isDead)
        {
            abilities.BluntTipArrow(3, 3, gameObject, KnockbackCD, knockbackArrowRange, knockbackSpread);
            anim.SetInteger("AnimState", 2);
        }
        else
        {
        }

        if (CTRLID != 0 && Input.GetKeyDown("joystick " + CTRLID + " button 1") && cooldowns.activeCooldowns[10] <= 0 && !altBuild && !health.isDead)
        {
            abilities.SmokeBomb(0, 3, gameObject, smokeBombCD, cloudSize, smokeDuration, dissipationRate);
            anim.SetInteger("AnimState", 2);
        }
        else
        {
        }

        if (CTRLID != 0 && Input.GetKeyDown("joystick " + CTRLID + " button 2") && cooldowns.activeCooldowns[9] <= 0 && !health.isDead)
        {
            visual = true;
            GetComponent <LineOfFireVisual>().OnBool(visual);
        }

        if (CTRLID != 0 && Input.GetKey("joystick " + CTRLID + " button 2") && altBuild && !health.isDead)
        {
            damageMult = Mathf.Clamp(damageMult += (Time.deltaTime * 2), 1, damageMultCap);
        }



        if (CTRLID != 0 && Input.GetKeyUp("joystick " + CTRLID + " button 2") && cooldowns.activeCooldowns[9] <= 0 && altBuild && !health.isDead)
        {
            visual = false;
            GetComponent <LineOfFireVisual>().OnBool(visual);
            abilities.RangedArrow(5 * damageMult, 3, gameObject, archerAttackCD, arrowRange);
            anim.SetInteger("AnimState", 2);
            damageMult = 1;
        }
        else
        {
        }

        if (CTRLID != 0 && Input.GetKeyUp("joystick " + CTRLID + " button 2") && cooldowns.activeCooldowns[9] <= 0 && !altBuild && !health.isDead)
        {
            visual = false;
            GetComponent <LineOfFireVisual>().OnBool(visual);
            abilities.RangedBolt(25, 3, gameObject, sniperAttackCD, boltRange);
            anim.SetInteger("AnimState", 2);
        }
        else
        {
        }



        if (CTRLID != 0 && Input.GetKeyDown("joystick " + CTRLID + " button 5"))
        {
            altBuild = !altBuild;
        }
        #endregion
        #region Health and Death

        if (h1 < h2)
        {
            rangedMat.SetColor("_EmissionColor", Color.HSVToRGB(1f, 1, 1));

            anim.SetInteger("AnimState", 1);
            h2 = h1;
        }
        else
        {
            rangedMat.SetColor("_EmissionColor", Color.HSVToRGB(1f, 1, 0));
        }

        if (health.isDead)
        {
            anim.SetInteger("AnimState", 5);
            walkspeed       = 0;
            playermovement *= 0;
        }
        else
        {
            walkspeed = 10;
        }
        #endregion
    }
    /*
     * AnimStates
     * 0 = idle
     * 1 = Walk
     * 2 = Attack
     * 3= Jump
     * 4 = GetHurt
     * 5= Death
     */
    void Update()
    {
        if (altBuild)
        {
            healerMat.color = Color.HSVToRGB(.2f, .89f, .5f);
        }
        else
        {
            healerMat.color = Color.HSVToRGB(.2f, .89f, .95f);
        }

        if (!altBuild && CTRLID != 0 && Input.GetKey("joystick " + CTRLID + " button 2"))
        {
            if (Input.GetAxis("J" + CTRLID + "Horizontal") > -1 && Input.GetAxis("J" + CTRLID + "Horizontal") < 0)
            {
                if (Input.GetAxis("J" + CTRLID + "Vertical") > 0 && Input.GetAxis("J" + CTRLID + "Vertical") < 1)
                {
                    healObject = controller.IDs[0].gameObject;
                    // transform.rotation = Quaternion.LookRotation(controller.IDs[0].gameObject.transform.position);
                    transform.LookAt(controller.IDs[0].gameObject.transform);

                    print(healObject);
                }
            }
            if (Input.GetAxis("J" + CTRLID + "Horizontal") > 0 && Input.GetAxis("J" + CTRLID + "Horizontal") < 1)
            {
                if (Input.GetAxis("J" + CTRLID + "Vertical") > 0 && Input.GetAxis("J" + CTRLID + "Vertical") < 1)
                {
                    healObject = controller.IDs[1].gameObject;
                    //transform.rotation = Quaternion.LookRotation(controller.IDs[1].gameObject.transform.position);
                    transform.LookAt(controller.IDs[1].gameObject.transform);


                    print(healObject);
                }
            }
            if (Input.GetAxis("J" + CTRLID + "Horizontal") > -1 && Input.GetAxis("J" + CTRLID + "Horizontal") < 0)
            {
                if (Input.GetAxis("J" + CTRLID + "Vertical") < 0 && Input.GetAxis("J" + CTRLID + "Vertical") > -1)
                {
                    healObject = controller.IDs[2].gameObject;
                    //transform.rotation = Quaternion.LookRotation(controller.IDs[2].gameObject.transform.position);
                    transform.LookAt(controller.IDs[2].gameObject.transform);


                    print(healObject);
                }
            }
            if (Input.GetAxis("J" + CTRLID + "Horizontal") > 0 && Input.GetAxis("J" + CTRLID + "Horizontal") < 1)
            {
                if (Input.GetAxis("J" + CTRLID + "Vertical") < 0 && Input.GetAxis("J" + CTRLID + "Vertical") > -1)
                {
                    healObject = controller.IDs[3].gameObject;
                    //transform.rotation = Quaternion.LookRotation(controller.IDs[3].gameObject.transform.position);
                    transform.LookAt(controller.IDs[3].gameObject.transform);


                    print(healObject);
                }
            }
        }
        if (CTRLID != 0 && Input.GetKeyUp("joystick " + CTRLID + " button 2") && cooldowns.activeCooldowns[3] <= 0 && !health.isDead && !altBuild)
        {
            abilities.TargetedHeal(20, 1, gameObject, orbCooldown, healObject, orbSpeed);
            stopTimer = 0;
        }

        anim.SetInteger("AnimState", 0);
        // colliders is for grounding the player, for jumping purposes.
        colliders = Physics.OverlapCapsule(transform.position, transform.position - (Vector3.up * .01f), .25f, groundMask, QueryTriggerInteraction.Ignore);
        h1        = health.health;
        #region Controls
        if (walkspeed >= 0 && CTRLID != 0 && !health.isDead)
        {
            playermovement = new Vector3(Input.GetAxis("J" + CTRLID + "Horizontal"), 0, Input.GetAxis("J" + CTRLID + "Vertical"));
            //Vector3 relpos = playermovement - transform.position;
            if (playermovement != Vector3.zero)
            {
                if (Input.GetKey("joystick " + CTRLID + " button 2"))
                {
                    stop = true;
                    if (cooldowns.activeCooldowns[3] > 0 && stopTimer == 0)
                    {
                        stopTimer = .5f;
                    }
                }

                if (!stop)
                {
                    transform.rotation = Quaternion.LookRotation(playermovement);
                    walkspeed          = 10;
                    transform.Translate(playermovement * walkspeed * Time.deltaTime, Space.World);
                    anim.SetInteger("AnimState", 1);
                }
            }
            else
            {
            }
        }
        if (CTRLID != 0 && colliders.Length > 0 && Input.GetKeyDown("joystick " + CTRLID + " button 0") && !health.isDead)
        {
            abilities.Jump(CTRLID, gameObject, jumpHeight);
            anim.SetInteger("AnimState", 3);
        }
        else
        {
        }

        if (CTRLID != 0 && Input.GetKey("joystick " + CTRLID + " button 3") && !health.isDead)
        {
            timer1 += Time.deltaTime;
            if (timer1 > reviveCastTime)
            {
                abilities.Revive(1, gameObject, reviveRadius);
            }
        }
        if (CTRLID != 0 && Input.GetKeyUp("joystick " + CTRLID + " button 3") && !health.isDead)
        {
            reviveCastTime = 0;
        }


        //if (CTRLID != 0 && Input.GetKeyDown("joystick " + CTRLID + " button 1") && cooldowns.activeCooldowns[4] <= 0 && altBuild)
        //{
        //    abilities.HealerAbsorb(absorbDamage, 1, gameObject, absorbCooldown);
        //    anim.SetInteger("AnimState", 2);
        //}
        //else
        //{
        //}

        if (CTRLID != 0 && Input.GetKeyDown("joystick " + CTRLID + " button 1") && cooldowns.activeCooldowns[4] <= 0 && altBuild && !health.isDead)
        {
            abilities.HealerCC(0, 1, gameObject, fearCooldown, fearRange, fearRunSpeed, fearDuration);
            anim.SetInteger("AnimState", 2);
        }
        else
        {
        }

        if (CTRLID != 0 && Input.GetKey("joystick " + CTRLID + " button 2") && cooldowns.activeCooldowns[3] <= 0 && !health.isDead && altBuild)
        {
            healVisual.SetActive(true);
            timer += Time.deltaTime;
            if (timer >= healInterval)
            {
                abilities.HealerHeal(-healAmount, 1, gameObject, healCooldown, healVisual, healRange);
                timer = 0;
            }
            anim.SetInteger("AnimState", 2);
        }
        else
        {
            healVisual.SetActive(false);
        }

        if (CTRLID != 0 && Input.GetKey("joystick " + CTRLID + " button 1") && cooldowns.activeCooldowns[4] <= 0 && !altBuild && !health.isDead)
        {
            //teleportDelay += Time.deltaTime;

            timer2 += Time.deltaTime;
            if (timer2 >= teleportDelay)
            {
                abilities.Healaport(0, 1, gameObject, teleportCooldown, teleportRange);
            }
        }


        if (CTRLID != 0 && Input.GetKeyDown("joystick " + CTRLID + " button 5"))
        {
            altBuild = !altBuild;
        }

        if (stop)
        {
            stopTimer += Time.deltaTime;
            if (stopTimer > .5f)
            {
                stop      = false;
                stopTimer = 0;
            }
            transform.rotation = transform.rotation;
            walkspeed          = 0;
        }
        else
        {
            walkspeed = 10;
        }

        #endregion
        #region Health and Death
        if (h1 < h2)
        {
            healerMat.SetColor("_EmissionColor", Color.HSVToRGB(1f, 1, 1));

            anim.SetInteger("AnimState", 4);
            h2 = h1;
        }
        else
        {
            healerMat.SetColor("_EmissionColor", Color.HSVToRGB(1f, 1, 0));
        }

        if (health.isDead)
        {
            anim.SetInteger("AnimState", 5);
            walkspeed       = 0;
            playermovement *= 0;
        }
        else
        {
            walkspeed = 10;
        }
        #endregion
    }