Beispiel #1
0
 void GolemTextEnraged()
 {
     if (BossName != null)
     {
         BossName.GetComponent <Text>().text = "Volcanic Golem Protector (Enraged)";
     }
 }
Beispiel #2
0
 void TakeDamage(float damageDealt)
 {
     currentHP = currentHP - damageDealt;
     StartCoroutine("DamageFlash");
     GameObject.Find("UIHandler").GetComponent <UIController>().AddPoints((float)Math.Round(damageDealt, 0));
     if (currentHP <= MAX_HP / 2 && enragedState == false)
     {
         float dist = Vector3.Distance(transform.position, GameObject.FindGameObjectWithTag("MainCamera").transform.position);
         float volume;
         volume = 1 - (dist / 100);
         if (volume < 0)
         {
             volume = 0;
         }
         GetComponent <AudioSource>().PlayOneShot(EnragedRoar, CalculateVol());
         enragedState = true;
         BossName.GetComponent <Text>().text = "The golem is ENRAGED!";
         DEFAULT_ATTACK_SPEED = DEFAULT_ATTACK_SPEED / 2f;
         StartCoroutine("GolemRoar");
         Invoke("GolemTextEnraged", 3f);
     }
     if (currentHP <= 0)
     {
         StartCoroutine("GolemDeath");
     }
 }
    void Start()
    {
        SetStrings = 1;
        SpriteRenderer spr = gameObject.GetComponent <SpriteRenderer>();

        switch (gameObject.name)
        {
        case "Boss_Dog":
        case "Boss_Dog(Clone)":
            SetStrings += PlayerPrefs.GetFloat("DOG");    //GameObject.Find("AllSceneManager").GetComponent<InstantSaveScript>().SettingsRead("DOG");
            AttackPref  = Resources.Load <GameObject>("EDogAttack");
            Spetial     = Resources.Load <GameObject>("dogcirle");
            boss        = BossName.BossDog;
            spr.sprite  = Resources.Load <Sprite>("dog");
            spr.color   = new Color32(95, 95, 255, 255);
            break;

        case "Boss_Monkey":
        case "Boss_Monkey(Clone)":
            SetStrings += PlayerPrefs.GetFloat("MONKEY");    //GameObject.Find("AllSceneManager").GetComponent<InstantSaveScript>().SettingsRead("MONKEY");
            AttackPref  = Resources.Load <GameObject>("EMonAttack");
            Spetial     = Resources.Load <GameObject>("EMonBomb");
            boss        = BossName.BossMonkey;
            spr.sprite  = Resources.Load <Sprite>("monkey");
            spr.color   = new Color32(132, 132, 132, 255);
            HP         += 100;
            break;

        case "Boss_Bird":
        case "Boss_Bird(Clone)":
            SetStrings += PlayerPrefs.GetFloat("BIRD");    //GameObject.Find("AllSceneManager").GetComponent<InstantSaveScript>().SettingsRead("BIRD");
            AttackPref  = Resources.Load <GameObject>("Efeather");
            Spetial     = Resources.Load <GameObject>("EfeatherSpetial");
            boss        = BossName.BossBird;
            spr.sprite  = Resources.Load <Sprite>("bird2");
            spr.color   = new Color32(255, 255, 0, 255);
            HP         += 200;
            break;
        }


        attackinterval = 3 - SetStrings;
        EffectObj      = Resources.Load <GameObject>("DamageText");

        AttackPref.GetComponent <SupportAttack>().AttackPower *= SetStrings;

        RandomWay          = new Vector3(0, 0);
        timer              = timerA = 0;
        HP                *= SetStrings;
        DHP                = HP;
        transform.position = new Vector3(-10, 1, 0);
        BattleStartPos     = new Vector3(-5, 1, 0);
        Status             = AttackChangeState.FullHP;
        Attackoffset       = new Vector3(1, 0);
        HPFlag             = 0;
    }
Beispiel #4
0
    void Start()
    {
        animator = GetComponent <Animator>();
        GameObject audioController;

        audioController = GameObject.FindGameObjectWithTag("MusicHandler");
        audioController.GetComponent <AudioController>().PlayMusic(2);
        foreach (GameObject obj in Resources.FindObjectsOfTypeAll(typeof(GameObject)) as GameObject[])
        {
            if (obj.name == "BossHPBar")
            {
                BossHPBar = obj;
            }
            if (obj.name == "BossHPBorder")
            {
                BossHPBorder = obj;
            }
            if (obj.name == "BossName")
            {
                BossName = obj;
            }
            if (obj.name == "GolemCharge")
            {
                GolemChargeText = obj;
            }
        }
        if (BossHPBar != null)
        {
            BossHPBar.SetActive(true);
        }
        if (BossHPBorder != null)
        {
            BossHPBorder.SetActive(true);
        }
        if (BossName != null)
        {
            BossName.SetActive(true);
        }
        if (GolemChargeText != null)
        {
            GolemChargeText.SetActive(false);
        }
        attackSpeedTimer = DEFAULT_ATTACK_SPEED;
        currentHP        = MAX_HP;
        ui         = GameObject.Find("UIHandler").GetComponent <UIController>();
        playerLook = GameObject.Find("playerLook");
        i          = GetComponent <Rigidbody>();
    }
Beispiel #5
0
    bool playerHit = false; //Used in damage check.



    void FixedUpdate()
    {
        if (UI == null)
        {
            UI = GameObject.Find("UIHandler");
        }
        if (UI != null)
        {
            if (ui.GetIsPaused())
            {
                BossHPBar.SetActive(false);
                BossHPBorder.SetActive(false);
                BossName.SetActive(false);
            }
            else
            {
                BossHPBar.SetActive(true);
                BossHPBorder.SetActive(true);
                BossName.SetActive(true);
            }
            if (Input.GetKeyDown(KeyCode.F7))
            {
                StartCoroutine("GolemDeath");
            }
        }
        if (chargeVelocity) //When charging, constantly reapply the same velocity.
        {
            i.velocity    = transform.forward * 25;
            i.constraints = RigidbodyConstraints.FreezePositionY;
        }
        else
        {
            i.constraints &= ~RigidbodyConstraints.FreezePositionY;  //Remove the constraint on position, to ensure golem is firmly on the ground!
        }
        Vector3 forward = transform.TransformDirection(Vector3.forward);

        Debug.DrawRay(transform.position + (Vector3.up * 3), forward * 5, Color.white);
        if (Physics.SphereCast(transform.position + (Vector3.up * 3), 1.5f, forward, out hit, 10))
        {
            Debug.Log("GOLEM HIT: " + hit.collider.gameObject.name);
            if (hit.collider.gameObject.name == "Player")
            {
                if (golemCharging == true)
                {
                    //Damage
                    playerHit = true;
                    Player         player  = hit.collider.gameObject.GetComponent <Player>();
                    MovementScript stunned = player.GetComponent <MovementScript>();
                    animator.SetBool("isCharging", false);
                    chargeVelocity = false;
                    stunned.StunPlayer(3f);
                    Invoke("DamagePlayerCharge", 3f);
                    i.velocity        = Vector3.zero;
                    i.angularVelocity = Vector3.zero;
                    golemCharging     = false;
                }
            }
            if (hit.collider.gameObject.layer != 12) //This prevents cancelling charge with a projectile.
            {
                golemCharging     = false;
                i.velocity        = Vector3.zero;
                i.angularVelocity = Vector3.zero;
                chargeVelocity    = false;
                animator.SetBool("isCharging", false);
            }
        }
        if (lookAtPlayer == true)
        {
            var playerRotation = Quaternion.LookRotation(GameObject.FindWithTag("MainCamera").transform.position - transform.position);
            transform.rotation = Quaternion.Slerp(transform.rotation, playerRotation, 2.5f * Time.deltaTime);
        }
        if (ui.GetIsPaused())
        {
            return;
        }
        if (attackTimerPause == true)
        {
            return;
        }
        if (transform.position.y < 0)
        {
            transform.position = new Vector3(transform.position.x, 0, transform.position.z);
        }

        attackSpeedTimer = attackSpeedTimer - Time.deltaTime;
        healthRemainingPercentage();
        if (attackSpeedTimer <= 0)
        {
            CURRENT_ATTACK_CYCLE = CURRENT_ATTACK_CYCLE + 1; //Iterate the cycle
            //Planned attack cycle:
            //Projectile -> Projectile -> Projectile
            //Spawn minions
            //Projectile -> Projectile -> Projectile
            //Charge at the player
            //Projectile x5
            //Spawn a mega minion
            //Projectile x3
            //Cycle from beginning
            switch (CURRENT_ATTACK_CYCLE)
            {
            case 1:
            {
                StartCoroutine("GolemThrowProjectile");
                attackSpeedTimer = DEFAULT_ATTACK_SPEED;
                return;
            }

            case 2:
            {
                StartCoroutine("GolemThrowProjectile");
                attackSpeedTimer = DEFAULT_ATTACK_SPEED;
                return;
            }

            case 3:
            {
                StartCoroutine("GolemThrowProjectile");
                attackSpeedTimer = DEFAULT_ATTACK_SPEED;
                return;
            }

            case 4:
            {
                if (enragedState)
                {
                    StartCoroutine("GolemThrowProjectile");
                }
                else
                {
                    StartCoroutine("GolemRoar");
                    MinionSpawn();
                }
                attackSpeedTimer = DEFAULT_ATTACK_SPEED;
                return;
            }

            case 5:
            {
                StartCoroutine("GolemThrowProjectile");
                attackSpeedTimer = DEFAULT_ATTACK_SPEED;
                return;
            }

            case 6:
            {
                StartCoroutine("GolemThrowProjectile");
                attackSpeedTimer = DEFAULT_ATTACK_SPEED;
                return;
            }

            case 7:
            {
                StartCoroutine("GolemThrowProjectile");
                attackSpeedTimer = DEFAULT_ATTACK_SPEED;
                return;
            }

            case 8:
            {
                ChargeAtPlayer();
                attackSpeedTimer = DEFAULT_ATTACK_SPEED;
                return;
            }

            case 9:
            {
                StartCoroutine("GolemThrowProjectile");
                attackSpeedTimer = DEFAULT_ATTACK_SPEED;
                return;
            }

            case 10:
            {
                StartCoroutine("GolemThrowProjectile");
                attackSpeedTimer = DEFAULT_ATTACK_SPEED;
                return;
            }

            case 11:
            {
                StartCoroutine("GolemThrowProjectile");
                attackSpeedTimer = DEFAULT_ATTACK_SPEED;
                return;
            }

            case 12:
            {
                StartCoroutine("GolemThrowProjectile");
                attackSpeedTimer = DEFAULT_ATTACK_SPEED;
                return;
            }

            case 13:
            {
                StartCoroutine("GolemThrowProjectile");
                attackSpeedTimer = DEFAULT_ATTACK_SPEED;
                return;
            }

            case 14:
            {
                //Spawn a mega minion
                MinionSpawn();
                StartCoroutine("GolemRoar");
                attackSpeedTimer = DEFAULT_ATTACK_SPEED;
                return;
            }

            case 15:
            {
                StartCoroutine("GolemThrowProjectile");
                attackSpeedTimer = DEFAULT_ATTACK_SPEED;
                return;
            }

            case 16:
            {
                StartCoroutine("GolemThrowProjectile");
                attackSpeedTimer = DEFAULT_ATTACK_SPEED;
                return;
            }

            case 17:
            {
                StartCoroutine("GolemThrowProjectile");
                attackSpeedTimer     = DEFAULT_ATTACK_SPEED;
                CURRENT_ATTACK_CYCLE = 0;         //Reset cycle
                return;
            }
            }
        }
    }
        private async Task LoadImplAsync(IProgress <string> progress, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            await Task.Delay(2000);

            cancellationToken.ThrowIfCancellationRequested();

            var provider = new ReportDataProvider();

            progress.Report($"Kampfdaten für {BossName} werden geladen.");
            var reportData = await provider.GetReportDataAsync(ReportId);

            var matchingFights = reportData.fights.Where(d => d.name.ToUpper() == BossName.ToUpper()).ToList();

            progress.Report($"{matchingFights.Count} Kämpfe gefunden.");
            await Task.Delay(1000);

            cancellationToken.ThrowIfCancellationRequested();

            var templates = Configuration.Templates.ToList();

            progress.Report($"{templates.Count} Auswertungsfelder gefunden.");
            await Task.Delay(1000);

            Dictionary <string, object>          tokenValueByPlayer = new Dictionary <string, object>();
            Dictionary <string, DynamicGridCell> cellByPlayer       = new Dictionary <string, DynamicGridCell>();

            var players = new HashSet <string>(reportData.friendlies.Select(s => s.name));

            foreach (var player in players)
            {
                var playerCell = new DynamicGridCell();
                playerCell["Spieler"] = player;
                cellByPlayer.Add(player, playerCell);
            }

            foreach (var template in templates)
            {
                tokenValueByPlayer.Clear();

                cancellationToken.ThrowIfCancellationRequested();

                var parser = ParserFactory.GetParser(template.ParserTypeName);
                parser.SetTemplate(template.Template);
//				var warcraftLogsContentParser = new GenericDamageTakenParser();
//				await warcraftLogsContentParser.GetResultsAsync(new FightContextData());
//				parser = warcraftLogsContentParser;
                foreach (var fight in matchingFights)
                {
                    cancellationToken.ThrowIfCancellationRequested();

                    var fightContext = new FightContextData()
                    {
                        Fight = fight, ReportId = ReportId
                    };
                    await parser.ApplyResultMappingAsync(cancellationToken, fightContext, tokenValueByPlayer, template.FieldWildcard);
                }

                foreach (var playerWithTokenValue in tokenValueByPlayer)
                {
                    cancellationToken.ThrowIfCancellationRequested();

                    DynamicGridCell cell;
                    if (cellByPlayer.TryGetValue(playerWithTokenValue.Key, out cell))
                    {
                        cell[template.FieldWildcard] = playerWithTokenValue.Value;
                    }
                }
            }

            var cells = new List <KeyValuePair <string, DynamicGridCell> >();

            foreach (var cell in cellByPlayer)
            {
                cells.Add(cell);
            }

            await Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
                                                                                                   ResultData.AddRange(cells.Select(s => s.Value))));
        }