示例#1
0
    public static void BossEnd(EBoss bossType, bool win, float time)
    {
        var boss = GetBossData(bossType);

        if (boss != null)
        {
            boss.TotalTime += Mathf.Ceil(time); // seconds

            if (win)
            {
                boss.WinCounter++;

                if (boss.BestTime == 0 || boss.BestTime > time)
                {
                    boss.BestTime = time * 1000f; // milliseconds
                }
            }
            else
            {
                boss.LoseCounter++;
            }

            Save();
        }
        else
        {
            Debug.LogError("No boss found with this name in the player data: " + bossType);
        }
    }
示例#2
0
    public GameObject GetBossPrefab(EBoss type)
    {
        if (!BossTypeToPrefabDictionary.ContainsKey(type))
        {
            return(null);
        }

        return(BossTypeToPrefabDictionary[type]);
    }
示例#3
0
    public void LoadBoss(EBoss BossType)
    {
        // TODO: Should create a new instance of a boss according to the given type
        var bossPrefab = BossStore.GetBossPrefab(BossType);

        if (bossPrefab)
        {
            var bossObject = Instantiate(bossPrefab);
            Boss = bossObject.GetComponent <AbstractBoss>();
        }
    }
示例#4
0
    public static BossData GetBossData(EBoss bossType)
    {
        var boss = _playerData.BossesData.FirstOrDefault(b => b.Type == bossType);

        if (boss == null)
        {
            Debug.LogError("No boss found in the player data with name: " + boss.Type);
        }

        return(boss);
    }
        internal EBossJumpState(Screen parentScreen, EBoss boss)
            : base(boss)
        {
            jumpTimer = new Timer(parentScreen, DELAY_BETWEEN_JUMP_DECISION);
            jumpTimer.TimeHasElapsed += new EventHandler<EventArgs>(jumpTimer_TimeHasElapsed);

            fallThroughTimer = new Timer(parentScreen, AMOUNT_OF_TIME_TO_TURN_OFF_TILE_COLLISION_DOWN);
            fallThroughTimer.TimeHasElapsed += new EventHandler<EventArgs>(fallThroughTimer_TimeHasElapsed);

            jumpThroughTimer = new Timer(parentScreen, AMOUNT_OF_TIME_TO_TURN_OFF_TILE_COLLISION_UP);
            jumpThroughTimer.TimeHasElapsed += new EventHandler<EventArgs>(jumpThroughTimer_TimeHasElapsed);

            lastJumpPosition = new Vector2();
        }
示例#6
0
 public void WaveStart()
 {
     NPC[] enemies = FindObjectsOfType <NPC>();
     foreach (var elem in enemies)
     {
         EBoss elemBoss = elem as EBoss;
         if (elemBoss)
         {
             elemBoss.Init(4.0f);
         }
         else
         {
             elem.Init(1.0f);
         }
     }
 }
示例#7
0
文件: Golem.cs 项目: justdoit7724/RPG
    public void InitGolem(Player player, float growRate)
    {
        this.growRate = growRate;

        EBoss boss = FindObjectOfType <EBoss>();

        if (boss)
        {
            if (hpBar == null)
            {
                hpBar = Instantiate(hpBarPrefab, uiCanvas).GetComponent <HPBar>();
            }
            hpBar.ShowUp(!boss.IsCurseOn);
        }

        this.player = player;

        if (nav)
        {
            nav.enabled = true;
        }
        if (mainCollider)
        {
            mainCollider.enabled = true;
        }

        float mAttRad = Mathf.Lerp(attRad.x, attRad.y, growRate);

        sqrAttRad = mAttRad * mAttRad;
        float mScale = Mathf.Lerp(bodyScale.x, bodyScale.y, growRate);

        transform.localScale = new Vector3(mScale, mScale, mScale);
        mStompDamage         = Mathf.Lerp(stompDamage.x, stompDamage.y, growRate);
        maxHP      = Mathf.Lerp(maxHPRange.x, maxHPRange.y, growRate);
        curHP      = maxHP;
        jumpSplash = Mathf.Lerp(jumpSplashRange.x, jumpSplashRange.y, growRate);
        GetComponent <CapsuleCollider>().radius = Mathf.Lerp(colliderSizeRange.x, colliderSizeRange.y, growRate);
        fist = GetComponentInChildren <MeleeWeapon>();
        fist.SetDamage(Mathf.Lerp(attDamage.x, attDamage.y, growRate));

        camShaker = Camera.main.GetComponent <CameraShakeSimpleScript>();
        camShaker.ShakeCaller(3.5f, 2.0f);

        StartCoroutine(IE_Enable());
    }
        internal EBossShootState(EBoss boss, Screen parentScreen)
            : base(boss)
        {
            //gunShot = ScreenManager.Instance.Content.Load<SoundEffect>("System\\Sounds\\mgkidShot");

            shootTimer = new Timer(parentScreen, 3000);
            shootTimer.TimeHasElapsed += new EventHandler<EventArgs>(shootTimer_TimeHasElapsed);

            delayBetweenBullet = new Timer(parentScreen, 50);
            delayBetweenBullet.TimeHasElapsed += new EventHandler<EventArgs>(delayBetweenBullet_TimeHasElapsed);

            laughTimer = new Timer(parentScreen, 3000);
            laughTimer.TimeHasElapsed += new EventHandler<EventArgs>(laughTimer_TimeHasElapsed);

            isReadyToShoot = true;
            hasTimerStarted = false;
            currentBulletCount = 0;
        }
示例#9
0
    public void Initialize(EBoss bossType)
    {
        if (_bossNameText)
        {
            _bossNameText.text = SessionData.SelectedBoss.ToString();
        }

        _bossBallIcon.sprite = _menuScreenManager.BossStore.GetBossBallSprite(SessionData.SelectedBoss, EBossBallState.Available);

        // Get boss data from player save
        var bossData = SaveSystem.GetBossData(bossType);

        if (bossData.BestTime > 0 && bossData.WinCounter > 0)
        {
            _bestTimeText.gameObject.transform.parent.gameObject.SetActive(true);
            _bestTimeText.text = TimeSpan.FromMilliseconds(bossData.BestTime).ToString("mm\\:ss\\.fff");
        }
        else
        {
            _bestTimeText.gameObject.transform.parent.gameObject.SetActive(false);
            _bestTimeText.text = "--:--.---";
        }

        var totalTime = TimeSpan.FromSeconds(bossData.TotalTime);

        if (totalTime.TotalMinutes >= 100)
        {
            _playTimeText.text = $"{totalTime.TotalMinutes}: {totalTime.Seconds}";
        }
        else
        {
            _playTimeText.text = totalTime.ToString("mm\\:ss");
        }

        _playerDeathsText.text = bossData.LoseCounter.ToString();
        _bossDeathsText.text   = bossData.WinCounter.ToString();

        _bossDeathsIcon.sprite = _bossStore.BossTypeToBossDeathIconSpriteDictionary[bossType];
    }
示例#10
0
    public Sprite GetBossBallSprite(EBoss type, EBossBallState spriteType)
    {
        switch (spriteType)
        {
        case EBossBallState.Available:
            if (BossTypeToBossBallAvailableSpriteDictionary.ContainsKey(type))
            {
                return(BossTypeToBossBallAvailableSpriteDictionary[type]);
            }
            break;

        case EBossBallState.Beaten:
            if (BossTypeToBossBallBeatenSpriteDictionary.ContainsKey(type))
            {
                return(BossTypeToBossBallBeatenSpriteDictionary[type]);
            }
            break;

        default:
            return(BossBallUnknownSprite);
        }

        return(BossBallUnknownSprite);
    }
 internal EBossLaughingState(EBoss boss)
     : base(boss)
 {
 }
 protected EBossState(EBoss boss)
 {
     this.boss = boss;
 }
 public void OnWinBossButtonClicked(EBoss bossType)
 {
     SaveSystem.BossEnd(bossType, true, 320f);
 }
示例#14
0
 public void SetBossType(EBoss bossType)
 {
     BossType     = bossType;
     Image.sprite = _bossStore.GetBossBallSprite(bossType, _state);
 }
示例#15
0
 public void ShowBossPanel(EBoss bossType)
 {
     _bossPanel.gameObject.SetActive(true);
     _bossPanel.Initialize(bossType);
 }
 internal EbossMoveState(EBoss boss)
     : base(boss)
 {
 }
 internal EBossHitState(EBoss boss)
     : base(boss)
 {
 }
示例#18
0
    public int LoseCounter = 0; // Count the times the player died against this boss

    public BossData(EBoss bossType)
    {
        Type = bossType;
    }