Ejemplo n.º 1
0
    void Awake()
    {
        SCR_gui.CreateScreenCover(0);

        if (skyBoxMaterial)
        {
            RenderSettings.skybox = skyBoxMaterial;
        }

        GameObject m    = GameObject.Find("MAIN");
        SCR_main   main = m.GetComponent <SCR_main>();

        GameObject spawnPointPlayer = GameObject.Find("SpawnPointPlayer");
        Vector3    playerPos        = new Vector3(spawnPointPlayer.transform.position.x, 0f, spawnPointPlayer.transform.position.z);

        if (main.playerSelect == true)
        {
            GameObject playerInst = Instantiate(main.playerObj1, playerPos, Quaternion.identity) as GameObject;
            Destroy(spawnPointPlayer);
        }
        else if (main.playerSelect == false)
        {
            GameObject playerInst = Instantiate(main.playerObj2, playerPos, Quaternion.identity) as GameObject;
            Destroy(spawnPointPlayer);
        }

        if (gameCompleteMusic && SCR_main.hMusic)
        {
            m.GetComponent <SCR_music>().PlayMusic(gameCompleteMusic);
        }
    }
Ejemplo n.º 2
0
    void Update()
    {
        if (alpha[0] != alpha[1])
        {
            int alphaSlot = 2;
            if (alpha[1] == 0f)
            {
                alphaSlot = 3;
            }

            alpha[0] = Mathf.MoveTowards(alpha[0], alpha[1], (alpha[alphaSlot] * SCR_main.counterMult));

            DisplayAlpha();

            if (alpha[1] == 0f && alpha[0] == 0f)
            {
                SCR_main.DestroyObj(gameObject);
            }
        }

        if (lifeSpan > 0f)
        {
            if (alpha[1] > 0f)
            {
                lifeSpan = Mathf.MoveTowards(lifeSpan, 0f, Time.deltaTime);

                if (lifeSpan == 0f)
                {
                    Kill();
                }
            }
        }
    }
Ejemplo n.º 3
0
    public void SetRotAngle(Vector3 destination)
    {
        dir = (destination - new Vector3(transform.position.x, 0f, transform.position.z));
        float distTotal = dir.magnitude;

        dir /= distTotal;

        rotAngle = SCR_main.GetAngle(new Vector2(transform.position.x, transform.position.z),
                                     new Vector2(destination.x, destination.z));
        rotAngle = (-rotAngle + 90f);
    }
Ejemplo n.º 4
0
    void UpdateAlpha()
    {
        alpha[0] = Mathf.MoveTowards(alpha[0], alpha[1], (changeSpeed[1] * SCR_main.counterMult));

        DisplayColour();

        if (alpha[0] == 0f && alpha[1] == 0f)
        {
            SCR_main.DestroyObj(gameObject);
        }
    }
Ejemplo n.º 5
0
    public bool Damage(int damage)
    {
        bool hitSuccess = false;
        bool canDamage  = true;

        if (health == 0 || character.rolling == 1 || character.invulnerable || character.stunned == 2)
        {
            canDamage = false;
        }

        if (character.isPlayer)
        {
            if (character.stunned == 1)
            {
                canDamage  = false;
                hitSuccess = true;
            }
        }

        if (canDamage)
        {
            health -= damage;

            if (health < 0)
            {
                health = 0;
            }

            if (character.isPlayer == false)
            {
                character.ai.Damage();
            }

            AlterHealthBar();

            character.AttackCancel();


            if (health > 0)
            {
                character.Hurt();
            }
            else
            {
                healthBar.Kill();
                character.Kill();
                SCR_main.PlayRandomSound(SND_death);
            }

            hitSuccess = true;
        }

        return(hitSuccess);
    }
Ejemplo n.º 6
0
    void Update()
    {
        if (lifeCounter > 0f)
        {
            lifeCounter = Mathf.MoveTowards(lifeCounter, 0f, Time.deltaTime);

            if (lifeCounter == 0f)
            {
                SCR_main.DestroyObj(gameObject);
            }
        }
    }
Ejemplo n.º 7
0
    public void StartUp()
    {
        cType=controlType;

        main=GetComponent<SCR_main>();

        if(highlightSound){
            SND_highlight=SCR_main.CreateSound(transform,highlightSound,false,false);
        }
        if(selectSound){
            SND_select=SCR_main.CreateSound(transform,selectSound,false,false);
        }
    }
Ejemplo n.º 8
0
    public void StartUp(int _spawnSlot)
    {
        spawnSlot           = _spawnSlot;
        transform.position += (Vector3.up * yOffset);

        //Mesh Setup

        int meshCount  = 0;
        int lightCount = 0;

        for (int i = 0; i < 2; i++)
        {
            foreach (Renderer m in gameObject.GetComponentsInChildren <Renderer>())
            {
                if (i == 1)
                {
                    mesh[meshCount] = m;
                }
                meshCount++;
            }

            foreach (Light l in gameObject.GetComponentsInChildren <Light>())
            {
                if (i == 1)
                {
                    lights[lightCount] = l;
                }
                lightCount++;
            }

            if (i == 0)
            {
                mesh = new Renderer[meshCount];

                if (lightCount > 0)
                {
                    lights = new Light[lightCount];
                }
            }

            meshCount  = 0;
            lightCount = 0;
        }

        if (collectSound)
        {
            SND_collect = SCR_main.CreateSound(transform, collectSound, false, true);
        }

        StartFlash();
    }
Ejemplo n.º 9
0
    void Awake()
    {
        character           = GetComponent <SCR_character>();
        attackReady         = true;
        attackBufferAllowed = true;

        dir = new GameObject("rangedDir");
        Transform dirTrans = dir.transform;

        dirTrans.parent             = transform;
        dir.transform.localPosition = Vector3.zero;

        SND_shot = SCR_main.SetupSoundArray(transform, shotSound, true, true);
    }
Ejemplo n.º 10
0
    void Update()
    {
        if (isActive == false)
        {
            if (destroyCounter != 0f)
            {
                destroyCounter = Mathf.MoveTowards(destroyCounter, 0f, Time.deltaTime);

                if (destroyCounter == 0f)
                {
                    SCR_main.DestroyObj(gameObject);
                }
            }
        }
    }
Ejemplo n.º 11
0
    public static SCR_sound[] SetupSoundArray(Transform parentTrans, AudioClip[] fxClips, bool randomPitch, bool distanceOn)
    {
        SCR_sound[] SND = null;

        if (fxClips != null)
        {
            SND = new SCR_sound[fxClips.Length];
            for (int i = 0; i < fxClips.Length; i++)
            {
                SND[i] = SCR_main.CreateSound(parentTrans, fxClips[i], randomPitch, distanceOn);
            }
        }

        return(SND);
    }
Ejemplo n.º 12
0
    public void StartUp()
    {
        cType = controlType;

        main = GetComponent <SCR_main>();

        if (highlightSound)
        {
            SND_highlight = SCR_main.CreateSound(transform, highlightSound, false, false);
        }
        if (selectSound)
        {
            SND_select = SCR_main.CreateSound(transform, selectSound, false, false);
        }
    }
Ejemplo n.º 13
0
    public void AttackHit()
    {
        if (lockActive == false)
        {
            TargetLock();
        }

        if (lockActive)
        {
            float dist = Vector2.Distance(new Vector2(transform.position.x, transform.position.z),
                                          new Vector2(target.transform.position.x, target.transform.position.z));

            if (dist <= (attackRange + (target.GetComponent <BoxCollider>().size.x *target.transform.localScale.x)))
            {
                bool hitSuccess = target.GetComponent <SCR_characterHealth>().Damage(damage);

                if (hitSuccess)
                {
                    SCR_character targetCha = target.GetComponent <SCR_character>();

                    Vector3 hitDir = (new Vector3(target.transform.position.x, 0f, target.transform.position.z) -
                                      new Vector3(transform.position.x, 0f, transform.position.z));
                    float distTotal = hitDir.magnitude;
                    hitDir /= distTotal;

                    targetCha.speed[0] += (hitDir * force);


                    if (attackHitObj)
                    {
                        Vector3    relativePos    = (target.transform.position - transform.position);
                        Quaternion attackRotation = Quaternion.LookRotation(relativePos);

                        GameObject attackHitInst = Instantiate(attackHitObj, transform.position, attackRotation) as GameObject;

                        Vector3 attackHitPos = (transform.position +
                                                (attackHitInst.transform.forward * attackHitOffset.z) +
                                                (attackHitInst.transform.up * attackHitOffset.y) +
                                                (attackHitInst.transform.right * attackHitOffset.x));

                        attackHitInst.transform.position = attackHitPos;
                    }

                    SCR_main.PlayRandomSound(SND_attackHit);
                }
            }
        }
    }
Ejemplo n.º 14
0
    void UpdateFlash()
    {
        flashCounter += SCR_main.counterMult;

        if (flashCounter >= 0.2f)
        {
            flashCounter = 0f;
            flashOn      = !flashOn;

            DisplayFlash();

            if (flashOn == false)
            {
                flashTotal--;

                if (flashTotal == 0)
                {
                    if (destroyAll)
                    {
                        SCR_main.OptionAction(actionID);
                        SCR_input.OptionCycle(2);
                        SCR_input.OptionCycle(3);
                    }
                    else
                    {
                        SCR_input.OptionCycle(4);

                        SCR_main main = GameObject.Find("MAIN").GetComponent <SCR_main>();

                        if (switchSoundFX)
                        {
                            main.AlterSetting(0);
                        }
                        else
                        {
                            if (switchMusic)
                            {
                                main.AlterSetting(1);
                            }
                        }


                        SetSwitchText();
                    }
                }
            }
        }
    }
Ejemplo n.º 15
0
    public void PowerBoostStart(int _powerBoost, float powerBoostDuration)
    {
        powerBoost        = _powerBoost;
        powerBoostCounter = powerBoostDuration;

        SCR_main main = GameObject.Find("MAIN").GetComponent <SCR_main>();

        if (main.powerBoostEffectObj)
        {
            GameObject powerBoostEffectInst = Instantiate(main.powerBoostEffectObj, transform.position, transform.rotation) as GameObject;

            Transform powerBoostEffectTrans = powerBoostEffectInst.transform;
            powerBoostEffectTrans.parent = transform;

            powerBoostObj = powerBoostEffectInst.GetComponent <SCR_particle>();
        }
    }
Ejemplo n.º 16
0
    void Update()
    {
        if (fading)
        {
            if (fadeCounter != 0f)
            {
                fadeCounter = Mathf.MoveTowards(fadeCounter, 0f, (Time.deltaTime * 3f));

                trail.endWidth = (trailWidth + ((1f + (fadeCounter * -1f)) * trailWidth * 5f));
                DisplayColour();

                if (fadeCounter == 0f)
                {
                    SCR_main.DestroyObj(gameObject);
                }
            }
        }
    }
Ejemplo n.º 17
0
    public void PlaySound()
    {
        if (SCR_main.fxOn == 1)
        {
            if (randomPitch)
            {
                GetComponent <AudioSource>().pitch = (1f + Random.Range(-0.1f, 0.1f));
            }

            if (distanceOn)
            {
                float distanceMult = SCR_main.GetSoundDistanceMultiplier(transform.position);
                GetComponent <AudioSource>().volume = distanceMult;
            }

            GetComponent <AudioSource>().Play();
        }
    }
Ejemplo n.º 18
0
    public void StartUp(bool isPlayer)
    {
        character           = GetComponent <SCR_character>();
        attackReady         = true;
        attackBufferAllowed = true;

        attackRange *= transform.localScale.x;

        if (isPlayer)
        {
            targetStr = "Enemy";
        }
        else
        {
            targetStr = "Player";
        }

        SND_attack    = SCR_main.SetupSoundArray(transform, attackSound, true, true);
        SND_attackHit = SCR_main.SetupSoundArray(transform, attackHitSound, true, true);
    }
Ejemplo n.º 19
0
    void Awake()
    {
        SCR_gui.CreateScreenCover(0);
        SCR_gui.CreateText("PlayerSelect", Vector3.zero);

        if (skyBoxMaterial)
        {
            RenderSettings.skybox = skyBoxMaterial;
        }

        GameObject m    = GameObject.Find("MAIN");
        SCR_main   main = m.GetComponent <SCR_main>();

        if (playerSelectMusic && SCR_main.hMusic)
        {
            m.GetComponent <SCR_music>().PlayMusic(playerSelectMusic);
        }

        SCR_main.level = 1;
    }
Ejemplo n.º 20
0
    void OnMouseDown()
    {
        GameObject m    = GameObject.Find("MAIN");
        SCR_main   main = m.GetComponent <SCR_main>();

        GameObject       s      = GameObject.Find("player select control");
        SCR_playerSelect player = s.GetComponent <SCR_playerSelect>();

        if (gameObject.tag == "Player01")
        {
            main.playerSelect = true;
        }
        else if (gameObject.tag == "Player02")
        {
            main.playerSelect = false;
        }

        SCR_main.level = 1;
        Application.LoadLevel(Application.loadedLevel + 1);
    }
Ejemplo n.º 21
0
    void Update()
    {
        if (flashTotal > 0)
        {
            UpdateFlash();
        }
        if (spinSpeed != 0f)
        {
            transform.Rotate(Vector3.up * spinSpeed * Time.deltaTime);
        }

        if (fadeCounter > 0f)
        {
            fadeCounter = Mathf.MoveTowards(fadeCounter, 0f, Time.deltaTime);

            if (fadeCounter == 0f)
            {
                SCR_main.DestroyObj(gameObject);
            }
        }
    }
Ejemplo n.º 22
0
    void Update()
    {
        mousePos = new Vector2(Input.mousePosition.x, Input.mousePosition.y);

        OptionCycle(0);

        if (rightClickAction >= 0)
        {
            if (Input.GetMouseButtonDown(1))
            {
                SCR_main.OptionAction(rightClickAction);
                OptionCycle(3);
                rightClickAction = -1;
            }
        }

        if (Input.GetMouseButtonDown(0))
        {
            OptionCycle(1);
        }
    }
Ejemplo n.º 23
0
    public void StartUp(int id)
    {
        health    = healthMax;
        character = GetComponent <SCR_character>();

        bool deathSoundRandomPitch = true;

        if (character.isPlayer)
        {
            deathSoundRandomPitch = false;
        }
        //death sound
        SND_death = SCR_main.SetupSoundArray(transform, deathSound, deathSoundRandomPitch, true);

        GameObject healthBarInst = Instantiate(SCR_main.healthBarObj, Vector3.zero, Quaternion.identity) as GameObject;

        healthBar = healthBarInst.GetComponent <SCR_healthBar>();
        healthBar.StartUp(id);

        UpdateHealthBar();
    }
Ejemplo n.º 24
0
    void UpdateAlpha()
    {
        if (alpha[1] == 1f)
        {
            alpha[0] = Mathf.MoveTowards(alpha[0], alpha[1], (alpha[2] * Time.deltaTime));
        }
        else
        {
            alpha[0] = Mathf.MoveTowards(alpha[0], alpha[1], (alpha[3] * Time.deltaTime));
        }

        DisplayColour();

        if (fadeAway)
        {
            if (alpha[0] == 0f && alpha[1] == 0f)
            {
                SCR_main.DestroyObj(gameObject);
            }
        }
    }
Ejemplo n.º 25
0
    void Kill()
    {
        if (isActive)
        {
            isActive = false;
            mesh.GetComponent <Renderer> ().enabled = false;

            destroyCounter = 1.5f;

            SCR_main.PlayRandomSound(SND_impact);

            if (impactEffectObj)
            {
                GameObject impactInst = Instantiate(impactEffectObj, transform.position, transform.rotation) as GameObject;
            }

            if (trail)
            {
                trail.Kill();
            }
        }
    }
Ejemplo n.º 26
0
    public void CreateProjectile()
    {
        dir.transform.rotation = character.rotTarget;

        float   projectileZ   = (projectileOffset.z * transform.localScale.z);
        Vector3 projectilePos = (transform.position +
                                 (dir.transform.right * projectileOffset.x * transform.localScale.x) +
                                 (dir.transform.up * projectileOffset.y * transform.localScale.y) +
                                 (dir.transform.forward * projectileZ));


        float middleDist = Vector2.Distance(new Vector2(character.attackPoint.x, character.attackPoint.z), new Vector2(transform.position.x, transform.position.z));

        if (middleDist > (projectileZ + 0.35f))
        {
            Vector3 relativePos = (new Vector3(character.attackPoint.x, projectilePos.y, character.attackPoint.z) - projectilePos);
            dir.transform.rotation = Quaternion.LookRotation(relativePos);
        }

        if (muzzleFlareObj)
        {
            GameObject muzzleFlareInst = Instantiate(muzzleFlareObj, projectilePos, dir.transform.rotation) as GameObject;
        }


        int damageFinal = shotDamage;

        if (character.powerBoost > 0)
        {
            float damageExtra = ((float)shotDamage * ((float)character.powerBoost * 0.01f));
            damageFinal += (int)damageExtra;
        }

        GameObject projectileInst = Instantiate(projectileObj, projectilePos, dir.transform.rotation) as GameObject;

        projectileInst.GetComponent <SCR_projectile>().StartUp(character.isPlayer, damageFinal);

        SCR_main.PlayRandomSound(SND_shot);
    }
Ejemplo n.º 27
0
    public void StartUp(bool isPlayer, int _damage)
    {
        damage = _damage;

        SND_impact = SCR_main.SetupSoundArray(transform, impactSound, true, true);

        if (GetComponent <SCR_projectileTrail> ())
        {
            trail = GetComponent <SCR_projectileTrail> ();
        }

        mesh = transform.Find(meshStr).GetComponent <Renderer> ();
        mesh.material.mainTexture = projectileTex;

        if (isPlayer)
        {
            targetStr = "Enemy";
        }
        else
        {
            targetStr = "Player";
        }
    }
Ejemplo n.º 28
0
    void Update()
    {
        UpdateScale();

        if (alpha[0] != alpha[1])
        {
            alpha[0] = Mathf.MoveTowards(alpha[0], alpha[1], (alpha[2] * SCR_main.counterMult));

            DisplayAlpha();

            if (alpha[0] == alpha[1])
            {
                if (alpha[1] == 1f)
                {
                    fadeFinished = true;
                }
                else
                {
                    SCR_main.DestroyObj(gameObject);
                }
            }
        }
    }
Ejemplo n.º 29
0
    void UpdateAction()
    {
        character.SetRotAngle(currentTargetEnemy.transform.position);

        actionCounter += Time.deltaTime;

        if (action == 0 || action == 1)
        {
            if (action == 0)
            {
                character.speed[1] = (character.dir * character.runSpeed);

                if (actionCounter >= actionLimit)
                {
                    SetAction(1);
                }
            }
            else
            {
                if (actionCounter >= actionLimit)
                {
                    SetAction(0);
                }
            }
            character.SetRotTarget();

            CheckPlayerDistance(1);
        }
        else
        {
            if (action == 2)
            {
                //ready to attack
                character.SetRotTarget();

                if (actionCounter >= actionLimit)
                {
                    SetAction(3);
                }

                CheckPlayerDistance(2);
            }
            else
            {
                if (action == 10)
                {
                    //dying

                    if (actionCounter >= 1.25f)
                    {
                        if (SCR_main.pOn)
                        {
                            SCR_text p = SCR_gui.CreateText("PopUpPoints", Vector3.zero);
                            p.UpdateText(points.ToString());
                            p.SetWorldPos(transform.position, 1f);
                            p.SetFadeSpeed(0.55f, 0.2f);
                        }

                        SetAction(11);
                        character.StartFlash(1, 1000);
                        GetComponent <BoxCollider>().isTrigger = true;
                    }
                }
                else
                {
                    if (action == 11)
                    {
                        //vanishing
                        if (actionCounter >= 0.55f)
                        {
                            SCR_main.DestroyObj(gameObject);
                        }
                    }
                }
            }
        }
    }
Ejemplo n.º 30
0
    void Awake()
    {
        GameObject m=GameObject.Find ("MAIN");
        main=m.GetComponent<SCR_main>();
        music=m.GetComponent<SCR_music>();

        if(stageMusic&&SCR_main.hMusic){
            music.PlayMusic(stageMusic);
        }

        SCR_input.playerControlActive=false;

        pauseAllowed=false;
        paused=false;
        SCR_main.scoreRec=SCR_main.score;
        scoreRec=SCR_main.score;

        GameObject camInst=Instantiate(stageCamera,Vector3.zero,Quaternion.identity) as GameObject;

        GameObject spawnPointPlayer=GameObject.Find ("SpawnPointPlayer");
        Vector3 playerPos=new Vector3(spawnPointPlayer.transform.position.x,0f,spawnPointPlayer.transform.position.z);

        if(main.playerSelect==true){
            GameObject playerInst=Instantiate(main.playerObj1,playerPos,Quaternion.identity) as GameObject;
            Destroy(spawnPointPlayer);
            player=playerInst.GetComponent<SCR_character>();

            SetupStageSize();

            cam=camInst.GetComponent<SCR_camStage>();
            cam.SetTarget(playerInst.transform);
            cam.InitiateStage(0);
         	}
        else if(main.playerSelect==false){
            GameObject playerInst=Instantiate(main.playerObj2,playerPos,Quaternion.identity) as GameObject;
            Destroy(spawnPointPlayer);
            player=playerInst.GetComponent<SCR_character>();

            SetupStageSize();

            cam=camInst.GetComponent<SCR_camStage>();
            cam.SetTarget(playerInst.transform);
            cam.InitiateStage(0);
        }

        if(skyBoxMaterial){
            RenderSettings.skybox=skyBoxMaterial;
        }

        if(SCR_main.hCursor){
            Cursor.visible=false;
        }

        SetState (10);

        SCR_gui.CreateScreenCover(0);
    }
Ejemplo n.º 31
0
    ////////////////////////
    //OPTION EVENTS
    ////////////////////////

    public static void OptionAction(int com)
    {
        //TITLE MENU OPTIONS

        if (com == 0)
        {
            //Go to Title Screen
            GameObject.FindWithTag("GameController").GetComponent <SCR_menu>().GotoMenu(0);
        }

        if (com == 1)
        {
            //Start Game
            GameObject.FindWithTag("GameController").GetComponent <SCR_menu>().FinishMenu();
            SCR_main.score = 0;
            SCR_main.level = 0;

            SCR_main.gotoScene = SCR_main.sName[0];
            SCR_main.fadeReady = true;
        }

        if (com == 2)
        {
            //Go to Options Screen
            GameObject.FindWithTag("GameController").GetComponent <SCR_menu>().GotoMenu(1);
        }

        if (com == 3)
        {
            //Go to Wipe Data Screen
            GameObject.FindWithTag("GameController").GetComponent <SCR_menu>().GotoMenu(2);
        }

        if (com == 4)
        {
            //Wipe Data CONFIRM
            GameObject.FindWithTag("GameController").GetComponent <SCR_menu>().FinishMenu();
            SCR_main.ResetData();
            SCR_main.gotoScene = "menu";
            SCR_main.fadeReady = true;
        }

        if (com == 5)
        {
            //Go to High Scores Screen
            GameObject.FindWithTag("GameController").GetComponent <SCR_menu>().GotoMenu(3);
        }


        //STAGE OPTIONS

        if (com == 10)
        {
            //Continue to the next stage
            SCR_main.level++;
            if (SCR_main.level < SCR_main.sName.Length)
            {
                SCR_main.gotoScene = SCR_main.sName[SCR_main.level];
            }
            else
            {
                SCR_main.gotoScene = "game complete";
            }
            SCR_main.fadeReady = true;
        }

        if (com == 11)
        {
            //Resume from being paused
            GameObject.FindWithTag("GameController").GetComponent <SCR_stage>().PauseEvent(false);
        }

        if (com == 12)
        {
            //Return to menu scene
            SetNewScore();
            SCR_main.gotoScene = "menu";
            SCR_main.fadeReady = true;
        }

        if (com == 13)
        {
            //Retry stage;
            SCR_main.score     = SCR_main.scoreRec;
            SCR_main.fadeReady = true;
        }
    }
Ejemplo n.º 32
0
    void Update()
    {
        if (character.attacking)
        {
            if (!GetComponent <Animation>().IsPlaying(character.animArray[attackAnimSlot]))
            {
                lockActive          = false;
                target              = null;
                attackReady         = true;
                attackBufferAllowed = true;

                if (attackBuffer == false)
                {
                    character.attacking = false;
                    attackCurrent       = 0;

                    if (character.isPlayer == false)
                    {
                        GetComponent <SCR_enemyAI>().SetAction(2);
                    }
                }
            }
        }

        if (attackBuffer && attackReady)
        {
            character.attacking = true;

            attackReady         = false;
            attackBuffer        = false;
            attackBufferAllowed = false;

            if (attackCurrent == 0)
            {
                if (character.running == false)
                {
                    attackAnimSlot = 5;
                    hitTimeCounter = standingAttack_1_hitTime;
                    damage         = standingAttack_1_damage;
                }
                else
                {
                    attackAnimSlot = 7;
                    hitTimeCounter = runningAttack_1_hitTime;
                    damage         = runningAttack_1_damage;
                }
            }

            if (attackCurrent == 1)
            {
                if (character.running == false)
                {
                    attackAnimSlot = 6;
                    hitTimeCounter = standingAttack_2_hitTime;
                    damage         = standingAttack_2_damage;
                }
                else
                {
                    attackAnimSlot = 8;
                    hitTimeCounter = runningAttack_2_hitTime;
                    damage         = runningAttack_2_damage;
                }
            }

            if (character.powerBoost > 0)
            {
                float damageExtra = ((float)damage * ((float)character.powerBoost * 0.01f));
                damage += (int)damageExtra;
            }

            attackSoundCounter = (hitTimeCounter - 0.15f);
            if (attackSoundCounter < 0f)
            {
                attackSoundCounter = 0f;
            }

            character.PlayAnim(attackAnimSlot);

            attackCurrent++;

            if (attackCurrent == attackTotal)
            {
                attackCurrent = 0;
            }

            if (character.isPlayer)
            {
                TargetLock();
            }
        }

        if (hitTimeCounter >= 0f)
        {
            if (attackSoundCounter >= 0f)
            {
                attackSoundCounter -= Time.deltaTime;

                if (attackSoundCounter < 0f)
                {
                    attackSoundCounter = -1f;
                    SCR_main.PlayRandomSound(SND_attack);
                }
            }

            hitTimeCounter -= Time.deltaTime;

            if (hitTimeCounter < 0f)
            {
                hitTimeCounter      = -1f;
                attackBufferAllowed = true;
                AttackHit();
            }
        }

        if (lockActive)
        {
            Vector3 destination = new Vector3(target.transform.position.x, 0f, target.transform.position.z);
            character.dir = (destination - new Vector3(transform.position.x, 0f, transform.position.z));
            float distTotal = character.dir.magnitude;
            character.dir /= distTotal;

            float rotAngle = SCR_main.GetAngle(new Vector2(transform.position.x, transform.position.z),
                                               new Vector2(destination.x, destination.z));
            rotAngle            = (-rotAngle + 90f);
            character.rotTarget = Quaternion.Euler(new Vector3(0f, rotAngle, 0f));
        }
    }