예제 #1
0
 void Start()
 {
     instance             = this;
     scriptPlayer         = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerTest>();
     scriptPlayer.enabled = false;
     scriptPlayer.enabled = true;
 }
예제 #2
0
    private void Start()
    {
        GameObject testPlayerObject = GameObject.FindWithTag("Player");

        if (testPlayerObject != null)
        {
            testPlayer = testPlayerObject.GetComponent <PlayerTest>();
        }
    }
예제 #3
0
    void Awake()
    {
        player = this;



        killedUnitEvent  = new KilledUnitEvent();
        spawnedUnitEvent = new SpawnedUnitEvent();
    }
예제 #4
0
    void HandleOnLocalPlayerJoined(PlayerTest player)
    {
        localPlayer      = player;
        cameraLookTarget = localPlayer.transform.Find("cameraLookTarget");

        if (cameraLookTarget == null)
        {
            cameraLookTarget = localPlayer.transform;
        }
    }
예제 #5
0
    // Start is called before the first frame update
    void Start()
    {
        rb          = GetComponent <Rigidbody2D>();
        swordColl   = GetComponent <PolygonCollider2D>();
        swordSprite = GetComponent <SpriteRenderer>();

        playerComp = player.GetComponent <PlayerTest>();

        swordIdle   = GetComponent <FixedJoint2D>();
        swordThrust = GetComponent <SliderJoint2D>();
        swordSwing  = GetComponent <HingeJoint2D>();
    }
예제 #6
0
    internal void OnCollisionEnter2D(Collision2D other)
    {
        PlayerTest otherPlayer = other.gameObject.GetComponent <PlayerTest>();

        if (otherPlayer != null)
        {
            if (otherPlayer.gameObject == parent)
            {
                parent.GetComponent <PlayerTest>().UpdateScore(-1);
            }
            else
            {
                parent.GetComponent <PlayerTest>().UpdateScore(2);
            }
        }
        Die();
    }
예제 #7
0
    private void Start()
    {
        intstance = this;

        for (int i = 0; i < 3; i++)
        {
            // var slot = new AbilitySlot(AbilitiesGUI[i], ((KeyCode) ((int) KeyCode.Alpha1) + i).GetKeyName());
            // abilitiesSlots.Add(slot);
        }

        var j = 0;

        foreach (var ability in Abilities)
        {
            abilitiesSlots[j].Init(ability);
            j++;
        }
    }
        /// <summary>
        /// Calculates the hp drop rate via some insane looping through the map.
        /// Oh god.
        /// </summary>
        /// <returns></returns>
        internal double CalculateHpDropRate()
        {
            double testDrop = 0.05;

            double lowestHpEver =
                hitObjectManager.MapDifficultyRange(BeatmapManager.Current.DifficultyHpDrainRate, 195, 160, 60);
            double lowestHpComboEnd =
                hitObjectManager.MapDifficultyRange(BeatmapManager.Current.DifficultyHpDrainRate, 198, 170, 80);
            double lowestHpEnd =
                hitObjectManager.MapDifficultyRange(BeatmapManager.Current.DifficultyHpDrainRate, 198, 180, 80);
            double HpRecoveryAvailable =
                hitObjectManager.MapDifficultyRange(BeatmapManager.Current.DifficultyHpDrainRate, 8, 4, 0);

            do
            {
                TotalHitsPossible = 0;

                HpBar.Reset();

                ComboCounter.HitCombo          = 0;
                Player.currentScore.TotalScore = 0;

                double lowestHp = HpBar.CurrentHp;
                int    lastTime = hitObjectManager.hitObjects[0].StartTime - hitObjectManager.PreEmpt;
                bool   fail     = false;

                int comboTooLowCount = 0;


                int breakCount  = player.eventManager.eventBreaks.Count;
                int breakNumber = 0;

                for (int i = 0; i < hitObjectManager.hitObjectsCount; i++)
                {
                    HitObject h = hitObjectManager.hitObjects[i];

                    //Find active break (between current and lastTime)
                    int localLastTime = lastTime;

                    int breakTime = 0;
                    if (breakCount > 0 && breakNumber < breakCount)
                    {
                        Event e = player.eventManager.eventBreaks[breakNumber];
                        if (e.StartTime >= localLastTime && e.EndTime <= h.StartTime)
                        {
                            breakTime = e.Length;
                            breakNumber++;
                        }
                    }

                    HpBar.ReduceCurrentHp(testDrop * (h.StartTime - lastTime - breakTime));

                    lastTime = h.EndTime;


                    if (HpBar.CurrentHp < lowestHp)
                    {
                        lowestHp = HpBar.CurrentHp;
                    }

                    if (HpBar.CurrentHp <= lowestHpEver)
                    {
                        //Debug.Print("Overall score drops below " + lowestHpEver + " at " + lastTime + " (" + testDrop + ", lowest " + lowestHp + ")");
                        fail      = true;
                        testDrop *= 0.96;
                        break;
                    }

                    if (h is HitCircleFruitsTick)
                    {
                        IncreaseScoreHit(IncreaseScoreType.FruitTick, h);
                    }
                    else if (h is HitCircleFruitsTickTiny)
                    {
                        IncreaseScoreHit(IncreaseScoreType.FruitTickTiny, h);
                    }
                    else if (h is HitCircleFruitsSpin)
                    {
                        HpBar.IncreaseCurrentHp(HpMultiplierNormal / 2);
                    }
                    else
                    {
                        if (i == hitObjectManager.hitObjectsCount - 1 ||
                            hitObjectManager.hitObjects[i + 1].NewCombo)
                        {
                            IncreaseScoreHit(IncreaseScoreType.Hit300g, h);
                            if (HpBar.CurrentHp < lowestHpComboEnd)
                            {
                                if (++comboTooLowCount > 2)
                                {
                                    HpMultiplierComboEnd *= 1.07;
                                    HpMultiplierNormal   *= 1.03;
                                    fail = true;
                                    break;
                                }
                            }
                        }
                        else
                        {
                            IncreaseScoreHit(IncreaseScoreType.Hit300, h);
                        }
                    }

                    if (!(h is HitCircleFruitsTickTiny) && !(h is HitCircleFruitsSpin))
                    {
                        TotalHitsPossible++;
                    }

                    h.MaxHp = HpBar.CurrentHp;
                }

                if (!fail && HpBar.CurrentHp < lowestHpEnd)
                {
                    //Debug.Print("Song ends on " + currentHp + " - being more lenient");
                    fail                  = true;
                    testDrop             *= 0.94;
                    HpMultiplierComboEnd *= 1.01;
                    HpMultiplierNormal   *= 1.01;
                }

                double recovery = (HpBar.CurrentHpUncapped - HP_BAR_MAXIMUM) / hitObjectManager.hitObjectsCount;
                if (!fail && recovery < HpRecoveryAvailable)
                {
                    //Debug.Print("Song has average " + recovery + " recovery - being more lenient");
                    fail                  = true;
                    testDrop             *= 0.96;
                    HpMultiplierComboEnd *= 1.02;
                    HpMultiplierNormal   *= 1.01;
                }

                if (fail)
                {
                    continue;
                }

                if (GameBase.TestMode)
                {
                    PlayerTest pt = player as PlayerTest;
                    if (pt != null)
                    {
                        pt.testMaxScore = Player.currentScore.TotalScore;
                        pt.testMaxCombo = ComboCounter.HitCombo;
                    }
                }

                Debug.Print("Loaded Beatmap " + BeatmapManager.Current.Filename);
                Debug.Print(string.Empty);
                Debug.Print("           stars: " + BeatmapManager.Current.DifficultyEyupStars);
                Debug.Print("           stars: " + BeatmapManager.Current.DifficultyEchoStars);
                Debug.Print("     slider rate: " + BeatmapManager.Current.DifficultySliderMultiplier);
                Debug.Print(" playable length: " + BeatmapManager.Current.DrainLength);
                Debug.Print("      hitobjects: " + BeatmapManager.Current.ObjectCount);
                Debug.Print("      hitcircles: " +
                            hitObjectManager.hitObjects.FindAll(h => h.IsType(HitObjectType.Normal)).Count);
                Debug.Print("         sliders: " +
                            hitObjectManager.hitObjects.FindAll(h => h.IsType(HitObjectType.Slider)).Count);
                Debug.Print("        spinners: " +
                            hitObjectManager.hitObjects.FindAll(h => h.IsType(HitObjectType.Spinner)).Count);
                Debug.Print("      drain rate: {0:00.00}%/s", (testDrop * 60) / 2);
                Debug.Print("       lowest hp: {0:00.00}%", lowestHp / 2);
                Debug.Print("normal multiplier: {0:00.00}x", HpMultiplierNormal);
                Debug.Print("combo multiplier: {0:00.00}x", HpMultiplierComboEnd);
                Debug.Print(" excess hp recov: {0:00.00}%/hitobject",
                            (float)(HpBar.CurrentHpUncapped - HP_BAR_MAXIMUM) / 2 / hitObjectManager.hitObjects.Count);
                Debug.Print("    max final hp: {0:00.00}%", HpBar.CurrentHp / 2);
                Debug.Print("       max combo: " + TotalHitsPossible);
                Debug.Print(string.Empty);

                return(testDrop);
            } while (true);
        }
예제 #9
0
        internal override void InitializeCalculations()
        {
            HpMultiplierNormal = 200 / (0.06 * HP_HIT_300 * hitObjectManager.hitObjects.FindAll(h => h is HitCircleTaiko).Count *
                                        hitObjectManager.MapDifficultyRange(hitObjectManager.Beatmap.DifficultyHpDrainRate, 0.5f, 0.75f, 0.98f));
            HpMultiplierComboEnd = 0; // 200 / (0.06 * HP_HIT_300 * hitObjectManager.hitObjectsCount * 0.94);

            TotalHitsPossible = hitObjectManager.hitObjects.FindAll(h => !(h is SliderTaiko)).Count;

            if (GameBase.TestMode)
            {
                for (int i = 0; i < hitObjectManager.hitObjectsCount; i++)
                {
                    HitObject         h = hitObjectManager.hitObjects[i];
                    IncreaseScoreType type;

                    if (h is HitCircleTaiko)
                    {
                        if (h.Finish)
                        {
                            type  = IncreaseScoreType.Hit300;
                            type |= IncreaseScoreType.TaikoLargeHitBoth;
                        }
                        else
                        {
                            type = IncreaseScoreType.Hit300;
                        }

                        IncreaseScoreHit(type, h);
                    }
                    else if (h is SliderTaiko)
                    {
                        SliderTaiko slider = (SliderTaiko)h;
                        type = IncreaseScoreType.TaikoDrumRoll;
                        if (slider.Finish)
                        {
                            type |= IncreaseScoreType.TaikoLargeHitBoth;
                        }

                        for (int j = 0; j < slider.hittablePoints.Count; j++)
                        {
                            IncreaseScoreHit(type, h);
                        }
                        continue;
                    }
                    else if (h is SpinnerTaiko)
                    {
                        SpinnerTaiko spinner = (SpinnerTaiko)h;
                        for (int j = 0; j < spinner.rotationRequirement + 1; j++)
                        {
                            IncreaseScoreHit(IncreaseScoreType.TaikoDenDenHit, h);
                        }
                        IncreaseScoreHit(IncreaseScoreType.TaikoDenDenComplete, h);
                    }
                }

                PlayerTest pt = player as PlayerTest;
                if (pt != null)
                {
                    pt.testMaxScore = Player.currentScore.TotalScore;
                    pt.testMaxCombo = ComboCounter.HitCombo;
                }
                Player.currentScore.TotalScore = 0;
                ComboCounter.HitCombo          = 0;
            }

            hitObjectManager.hitObjects.ForEach(h => h.MaxHp = 200);

            //Make the graph look correct.

            base.InitializeCalculations();
        }
예제 #10
0
        private static void testPlayerActors()
        {
            var playerTest = new PlayerTest();

            playerTest.Run();
        }
예제 #11
0
 /// <summary>
 ///     Registers types this PlayerController requires the system to use.
 /// </summary>
 public override void RegisterTypes()
 {
     PlayerTest.Register <PlayerTest>();
 }
예제 #12
0
 void Start()
 {
     _playerScript = GameObject.Find("Sphere").GetComponent <PlayerTest>();
     isTornadoFlug = false;
 }
예제 #13
0
 void Start()
 {
     _playerScript = GameObject.Find("Sphere").GetComponent <PlayerTest>();
 }
예제 #14
0
 void Awake()
 {
     Instance = this;
 }
예제 #15
0
 private void Start()
 {
     cChara = GameObject.Find("ChangePlayer").GetComponent <ChangeCharacter>();
     pTest  = GetComponentInChildren <PlayerTest>();
 }