private List <InstantEffect> CreateInstantEffectsFromText(List <string> text)
    {
        List <InstantEffect> effects = new List <InstantEffect>();

        int i = -1;

        while (i < text.Count - 1)
        {
            switch (text[++i])
            {
            case "HealthInstantEffect":
                HealthInstantEffect healthInstantEffect = new HealthInstantEffect()
                {
                    healthModifier = float.Parse(text[++i])
                };
                effects.Add(healthInstantEffect);
                break;

            case "DestroyEffect":
                DestroyEffect destroyEffect = new DestroyEffect();
                effects.Add(destroyEffect);
                break;

            case "":
                break;

            default:
                Debug.LogError("Unknown instant effect type: " + text[i]);
                break;
            }
        }

        return(effects);
    }
Beispiel #2
0
 void Start()
 {
     spriteRenderer = GetComponent <SpriteRenderer>();
     particleSystem = GetComponent <ParticleSystem>();
     GetComponent <ParticleSystemRenderer>().sortingOrder = 10;
     destroyEffect      = GetComponentInChildren <DestroyEffect>();
     destroyEffect.cell = this;
 }
Beispiel #3
0
 private void GameOver()
 {
     Health = 0f;
     PauseGame.NotDestroyed = false;
     DestroyEffect.SetActive(true);
     FindObjectOfType <AudioManager>().Play("Player Death");
     playerFreez    = true;
     Time.timeScale = 0.05f;
     StartCoroutine(StopAllCars());
 }
	public override void InitComponent () {
		base.InitComponent ();

		movedByInput = false;
		
		lastNeighborTile = null;
		
		if (prefabDestroyEffect) {
			destroyEffect = prefabDestroyEffect.GetComponent<DestroyEffect>();
		}
	}
    public override void InitComponent()
    {
        tilesToDestroy.Clear();
        base.InitComponent();

        wasFirstTapped = false;

        match3BoardRenderer = BoardRenderer as Match3BoardRenderer;
        tilesDestroyEffect  = prefabTilesDestroyEffect.GetComponent <DestroyEffect>();

        delayBeforeTileDestroy = cachedAnimation["effect_winterchill_destruction"].length;
    }
Beispiel #6
0
    /// <summary>
    /// Event raised by the <see cref="WinterchillEffect"/> spawned in the "SpawnEffect(float angle)" method when the freeze trigger
    /// collider is disabled.
    /// </summary>
    /// <param name='sender'>
    /// Sender.
    /// </param>
    void OnWinterchillEffectFinished(DestroyEffect sender)
    {
        numEffectsFinished--;

        // All winter chill effects finished
        if (numEffectsFinished <= 0)
        {
            StartCoroutine(DestroyTilesAfterDelay(0.1f));
        }

        sender.OnEffectFinished = null;
    }
	public override void InitComponent ()
	{
		tilesToDestroy.Clear();
		base.InitComponent ();
		
		wasFirstTapped = false;
		
		match3BoardRenderer = BoardRenderer as Match3BoardRenderer;
		tilesDestroyEffect = prefabTilesDestroyEffect.GetComponent<DestroyEffect>();
		
		delayBeforeTileDestroy = cachedAnimation["effect_winterchill_destruction"].length;
	}
Beispiel #8
0
    public override void InitComponent()
    {
        base.InitComponent();

        movedByInput = false;

        lastNeighborTile = null;

        if (prefabDestroyEffect)
        {
            destroyEffect = prefabDestroyEffect.GetComponent <DestroyEffect>();
        }
    }
Beispiel #9
0
	public virtual void StartUsingItem(Match3BoardGameLogic _boardLogic)
	{
		boardLogic = _boardLogic;		
		
		if (effectPrefab) {
			destroyEffect = effectPrefab.GetComponent<DestroyEffect>();
		}
		
		if (OnStartUsingAnyItem != null)
		{
			OnStartUsingAnyItem(this);
		}
	}
    public virtual void StartUsingItem(Match3BoardGameLogic _boardLogic)
    {
        boardLogic = _boardLogic;

        if (effectPrefab)
        {
            destroyEffect = effectPrefab.GetComponent <DestroyEffect>();
        }

        if (OnStartUsingAnyItem != null)
        {
            OnStartUsingAnyItem(this);
        }
    }
Beispiel #11
0
    /// <summary>
    /// Event raised by the <see cref="WinterchillEffect"/> spawned in the "SpawnEffect(float angle)" method when the freeze trigger
    /// collider is disabled.
    /// </summary>
    /// <param name='sender'>
    /// Sender.
    /// </param>
    void OnBombDestroyEffectFinished(DestroyEffect sender)
    {
        if (OnTriggerBombTileDestroy != null)
        {
            OnTriggerBombTileDestroy(this);
        }

        sender.OnEffectFinished = null;
        // Disable the bomb destroy effect trigger.
        (sender as TileBombDestroyEffect).destroyTrigger.gameObject.SetActive(false);

        LayeredBoardPiece layeredBoardPiece;

        for (int i = 0; i < layeredBoardPiecesToDestroy.Count; i++)
        {
            layeredBoardPiece = layeredBoardPiecesToDestroy[i] as LayeredBoardPiece;

            if (layeredBoardPiece != null && layeredBoardPiece.Tile == null)
            {
                layeredBoardPiece.NumLayers--;
            }
        }

//		StartCoroutine(DestroyTilesAfterDelay(0.1f));
        // Destroy the detected tiles
        NormalTile tile;

        for (int i = 0; i < tilesToDestroy.Count; i++)
        {
            tile = tilesToDestroy[i];
            if (tile != null && !tile.IsDestroying && tile.IsDestructible)
            {
//				tile.ApplyPunchEffectToNeighbors(-1, 1, 1);
                tile.Destroy();
            }
        }

//		// Destroy this tile without triggering any visual effect.
        base.TileDestroy(false);
    }
Beispiel #12
0
    void Start()
    {
        rb = GetComponent <Rigidbody>();
        cl = GetComponent <Collider>();
        // rb.centerOfMass = 0;
        collidePoint = transform.position; // + (rb.centerOfMass + Vector3.up * cl.bounds.size.y * 0.8f);
        toppled      = false;

        CHC = GameObject.Find("CentralHumanController").GetComponent <CentralHumanController>();
        CHC.registerObject(this.gameObject);

        KnockedSound = GetComponent <AudioSource>();
        StartCoroutine(AudioLoadIn());

        //Audio Engine
        if (_hasAudio)
        {
            KnockedSound.clip = objectKnock;
        }

        df = GetComponent <DestroyEffect>();
    }
    public void DestroyElement()
    {
        if (m_RemoveEffect != null)
        {
            GameObject    effect = (GameObject)Instantiate(m_RemoveEffect, transform.position, transform.rotation);
            DestroyEffect de     = effect.GetComponent <DestroyEffect>();
            de.SetRescue(m_Species != null);
        }

        m_InfoBar.AddMaterial(1);
        DestroyObject(gameObject);
        m_BG.SetElementByCoord(m_TargetCoord, null);

        if (m_SkillBt != null)
        {
            m_SkillBt.AddAmount(0.2f);
        }
        if (m_Species != null)
        {
            SpeciesInfo si = m_Species.GetComponent <SpeciesInfo>();
            si.SpeciesRescued();
            m_InfoBar.AddDNANum(1);
        }
    }
Beispiel #14
0
	/// <summary>
	/// Event raised by the <see cref="WinterchillEffect"/> spawned in the "SpawnEffect(float angle)" method when the freeze trigger
	/// collider is disabled.
	/// </summary>
	/// <param name='sender'>
	/// Sender.
	/// </param>
	void OnBombDestroyEffectFinished(DestroyEffect sender) {
		if (OnTriggerBombTileDestroy != null) {
			OnTriggerBombTileDestroy(this);
		}
			
		sender.OnEffectFinished = null;
		// Disable the bomb destroy effect trigger.
		(sender as TileBombDestroyEffect).destroyTrigger.gameObject.SetActive(false);

		LayeredBoardPiece layeredBoardPiece;
		for(int i = 0; i < layeredBoardPiecesToDestroy.Count; i++) {
			layeredBoardPiece = layeredBoardPiecesToDestroy[i] as LayeredBoardPiece;
			
			if(layeredBoardPiece != null && layeredBoardPiece.Tile == null)
			{
				layeredBoardPiece.NumLayers--;
			}
		}
		
//		StartCoroutine(DestroyTilesAfterDelay(0.1f));
		// Destroy the detected tiles
		NormalTile tile;
		for(int i = 0; i < tilesToDestroy.Count; i++) {
			tile = tilesToDestroy[i];
			if (tile != null && !tile.IsDestroying && tile.IsDestructible) {
//				tile.ApplyPunchEffectToNeighbors(-1, 1, 1);
				tile.Destroy();
			}
		}
		
//		// Destroy this tile without triggering any visual effect.
		base.TileDestroy(false);
	}
 void Awake()
 {
     destroyEffect = GetComponent <DestroyEffect>();
     rt            = GetComponent <RectTransform>();
     anim          = GetComponent <Animator>();
 }
    //private bool fragile = false;

    private void Start()
    {
        df = GetComponent <DestroyEffect>();
    }
	/// <summary>
	/// Event raised by the <see cref="WinterchillEffect"/> spawned in the "SpawnEffect(float angle)" method when the freeze trigger
	/// collider is disabled.
	/// </summary>
	/// <param name='sender'>
	/// Sender.
	/// </param>
	void OnWinterchillEffectFinished(DestroyEffect sender) {
		numEffectsFinished--;
		
		// All winter chill effects finished
		if (numEffectsFinished <= 0) {
			StartCoroutine(DestroyTilesAfterDelay(0.1f));
		}

		sender.OnEffectFinished = null;
	}