Пример #1
0
    public void DestroyCard()
    {
        backRenderer.enabled = false;
        Destroy(UIHolder);
        if (cardType == GameManager.CardType.Monster)
        {
            GameManager.Instance.GainAP(APWin);
            GameManager.Instance.UpdateRoomList(this);
        }
        else if (isInHand)
        {
            GameManager.Instance.RemoveHandCard(this);
        }

        if (cardType == GameManager.CardType.Heal && targetAttackCard != null)
        {
            dissolve.StartDissolve(GameManager.CardType.Attack);
        }
        else
        {
            dissolve.StartDissolve(cardType);
        }

        GetComponent <BoxCollider2D>().enabled = false;
        Invoke("DestroyGameObject", 1.5f);
    }
Пример #2
0
 void DeactivateShield()
 {
     _dissolveEffect.StartDissolve(1f);
     _isShieldActive = false;
     //_uIManager.DeactivateShieldImage();
     Invoke("EndShield", 1f);
 }
Пример #3
0
    IEnumerator DeathRoutine()
    {
        if (OnDeath != null)
        {
            OnDeath(this.gameObject);
        }

        animator.SetBool("isIdle", true);
        //dissolveEffect.bIsDissolving = true;
        dissolveEffect.StartDissolve();
        yield return(new WaitForSeconds(deathDelay));

        Destroy(gameObject);
    }
Пример #4
0
    // Start is called before the first frame update
    void Start()
    {
        //set the players position when initiated
        transform.position = new Vector3(-4.5f, 0, 0);
        _spawnManager      = GameObject.Find("Spawn Manager").GetComponent <SpawnManager>();
        if (_spawnManager == null)
        {
            Debug.Log("Spawn manager is NULL");
        }
        _uIManager = GameObject.Find("UIManager").GetComponent <UIManager>();
        if (_uIManager == null)
        {
            Debug.Log("UI Manager is null");
        }
        _uIManager.UpdateBullets(_maxAmmo);
        _currentAmmo = 15;
        sfx          = GameObject.FindWithTag("GameData").GetComponentsInChildren <AudioSource>();
        _cameraShake = GameObject.Find("CameraShake").GetComponent <CameraShake>();
        _lives       = _maxLives;
        _healthBar.SetHealth((float)_lives, (float)_maxLives);

        _dissolveEffect = _shieldPrefab.GetComponentInChildren <DissolveEffect>();
        _dissolveEffect.StartDissolve(1f);
    }
Пример #5
0
    IEnumerator Teleport()
    {
        //Gets components needed
        DissolveEffect dissolveEffect = Player.GetComponent <DissolveEffect>();
        PlayerMovement playerMovement = Player.GetComponent <PlayerMovement>();
        Teleporter     teleport       = otherTeleporter.GetComponent <Teleporter>();

        dissolveEffect.StartDissolve(2f);
        yield return(new WaitForSeconds(1f));

        //Teleports the player
        PlayerController.isGamePaused = true;
        Player.transform.position     = new Vector2(otherDestination.transform.position.x, otherDestination.transform.position.y);
        teleport.allowTeleport        = false;
        dissolveEffect.StopDissolve(2f);

        yield return(new WaitForSeconds(0.35f));

        PlayerController.isGamePaused = false;

        yield return(new WaitForSeconds(0.2f));

        teleport.allowTeleport = true;
    }