Beispiel #1
0
    public IEnumerator Execute(EnemyData data)
    {
        healthBehavior.Init(data.health);
        if (data.defeatTimeLimit > 0)
        {
            StartCoroutine(StartCountDownTimer(data.defeatTimeLimit));
        }
        while (IsDead == false)
        {
            if (gameStateData.isFail)
            {
                yield break;
            }
            yield return(null);
        }
        animator.SetTrigger("die");
        audioSource.clip = deadClip;
        audioSource.Play();
        dropableBehavior.CheckDropItem(data.willDropItemId, data.dropProbability);
        playerController.AddExp(data.health);
        gameUIController.countDownTimerEffect.Hide();
        yield return(new WaitForSeconds(animator.GetCurrentAnimatorStateInfo(0).length));

        yield return(StartCoroutine(meshFader.FadeOut()));
    }
    private void Awake()
    {
        m_projectilePrefab = Resources.Load <GameObject>("Prefabs/Bosses/Basic Boss/BossProjectile");

        m_spriteRenderer = transform.GetChild(0).GetComponent <SpriteRenderer>();

        m_wormholePrefab           = Resources.Load <GameObject>("Prefabs/Bosses/Basic Boss/Wormhole");
        m_wormholeProjectilePrefab = Resources.Load <GameObject>("Prefabs/Bosses/Basic Boss/WormholeProjectile");

        m_healthComp = GetComponent <HealthComponent>();
        m_healthComp.Init(50, OnHurt, OnDeath);
    }
    /// <summary>
    /// 請呼叫我,開始敵人生命
    /// </summary>
    /// <returns></returns>
    public IEnumerator Execute()
    {
        healthComponent.Init(100);
        while (IsDead == false)//當還活著,死了跳出迴圈
        {
            yield return(null);
        }
        animator.SetTrigger("die");
        audioSource.clip = deadClip;
        audioSource.Play();
        yield return(new WaitForSeconds(animator.GetCurrentAnimatorStateInfo(0).length)); //當前播放的animator裡的動畫片段的長度

        yield return(StartCoroutine(meshFader.FadeOut()));                                //呼叫淡出
    }
Beispiel #4
0
    public IEnumerator Execute(EnemyData enemyData) //寫入資料
    {
        healthComponent.Init(enemyData.health);     //讀入血量
        while (IsDead == false)
        {
            yield return(null); //等待
        }
        animator.SetTrigger("die");
        audioSource.clip = deadClip;
        audioSource.Play();
        yield return(new WaitForSeconds(animator.GetCurrentAnimatorStateInfo(0).length));

        yield return(StartCoroutine(meshFader.FadeOut()));
    }
        public override void Init(SpawnManager spawner, TeamColor teamColor)
        {
            base.Init(spawner, teamColor);

            GameManager     gameManager     = GameManager.Instance;
            SceneController sceneController = gameManager.sceneController;

            if (playerState == null)
            {
                playerState = this.gameObject.AddComponent <PlayerStateManager>();
            }
            audioSystem = this.GetComponent <VesselAudioSystem>();
            audioSystem.Init(EntityType.Player);
            audioSystem.PlayFlightAudio(vesselSelection);
            PlayerSettings playerSettings = gameManager.gameSettings.playerSettings;

            //Initialise Stat Handler
            GameSettings    gameSettings = gameManager.gameSettings;
            VesselShipStats vesselStats  = gameSettings.vesselStats.Where(x => x.type == vesselSelection).First();
            BaseStats       playerStats  = vesselStats.baseShipStats;

            statHandler = new StatHandler(playerStats, EntityType.Player, this);

            //Initialize Health Component
            HealthComponent healthComponent = this.GetComponent <HealthComponent>();

            healthComponent.Init(statHandler, sceneController);

            //Initialise Weapon System
            IWeaponSystem weaponSystem = this.GetComponent <IWeaponSystem>();

            weaponSystem.Init(GetObjectID(), this, false, vesselStats, sceneController);

            //Initializes the player's camera system
            cameraController = this.GetComponent <CameraController>();
            cameraController.Init(virtualCamera, vesselSelection);

            //Load weapon/damage components.
            FighterDamageManager damageManager = this.GetComponent <FighterDamageManager>();

            damageManager.Init(statHandler, audioSystem);

            //Load Movement Manager
            MovementRegister movementRegister = this.GetComponent <MovementRegister>();

            Debug.Log(movementRegister);
            movementRegister.Init(this, cameraController);

            SetInitalState();
        }
Beispiel #6
0
    public IEnumerator Execute(EnemyData enemyData)
    {
        healthComponent.Init(enemyData.health); //初始化
        while (IsDead == false)                 //敵人是否已死亡
        {
            yield return(null);
        }

        animator.SetTrigger("die");
        audioSource.clip = deadClip;
        audioSource.Play();

        yield return(new WaitForSeconds(animator.GetCurrentAnimatorClipInfo(0).Length)); //等待,動畫播放的時間長度

        yield return(StartCoroutine(meshFader.FadeOut()));                               //淡出
    }
Beispiel #7
0
    private void Awake()
    {
        m_rigidbody   = GetComponent <Rigidbody>();
        m_playerInput = GetComponent <PlayerInput>();
        m_health      = GetComponent <HealthComponent>();
        m_health.Init(100, OnHurt, Downed, OnHealed);

        m_mana = GetComponent <ManaComponent>();
        m_mana.Init(GenerateNewCard, ManaUpdated, ManaUpdated);
        m_cardPool = new List <ECard>();
        foreach (ECard card in CardManager.m_kCardSuits.Keys)
        {
            if (card == ECard.None)
            {
                continue;
            }
            if (CardManager.m_kCardSuits[card] == m_playerSuit || CardManager.m_kCardSuits[card] == ESuit.None)
            {
                m_cardPool.Add(card);
            }
        }
    }