Beispiel #1
0
	void OnTriggerEnter2D(Collider2D collider)
	{
		if(CurrentState == EPlayerState.Dying)
			return;

		Villager villager = collider.GetComponent<Villager>();
        Altar altar = collider.GetComponent<Altar>();
        PrayerSpot prayerSpot = collider.GetComponent<PrayerSpot>();
		Beast beast = collider.GetComponent<Beast>();
		if(villager != null && !collidingVillagers.Contains(villager) && villager.CanBePickedUp())
		{
			villager.ShowThought();
			if(collidingVillagers.Count > 0)
				collidingVillagers[collidingVillagers.Count - 1].GetComponent<Flash>().HideFlash();

			collidingVillagers.Add(villager);
			if(!IsCarryingVillager)
				villager.GetComponent<Flash>().ShowFlash();

		}
        else if(altar != null)
        {
            IsOnAltar = true;
			altar.AltarSprite.transform.GetComponent<Flash>().ShowFlash();
        }
        else if (prayerSpot != null)
        {
			if(currentPrayerSpot != null)
				currentPrayerSpot.GetComponent<Flash>().HideFlash();
            IsOnPrayerSpot = true;
            currentPrayerSpot = prayerSpot;
			currentPrayerSpot.GetComponent<Flash>().ShowFlash();
        }
		else if(beast != null && beast.ReadyToAttack())
		{
			beast.Attack();
			Die();
			//GameController.Instance.GameOver();
		}
	}
Beispiel #2
0
	void OnTriggerExit2D(Collider2D collider)
	{
		Villager villager = collider.GetComponent<Villager>();
        Altar altar = collider.GetComponent<Altar>();
        PrayerSpot prayerSpot = collider.GetComponent<PrayerSpot>();
        if (villager != null && collidingVillagers.Contains(villager))
		{
			villager.HideThought();
			villager.GetComponent<Flash>().HideFlash();
			collidingVillagers.Remove(villager);
		}
        else if(altar != null)
        {
            IsOnAltar = false;
			altar.AltarSprite.transform.GetComponent<Flash>().HideFlash();
        }
        else if(prayerSpot != false)
        {
            IsOnPrayerSpot = false;
			currentPrayerSpot.GetComponent<Flash>().HideFlash();
            currentPrayerSpot = null;
        }
	}
	public void HandleBeingDroppedAsCultist(PrayerSpot prayerSpot)
	{
		CurrentState = EVillagerState.Praying;
		this.transform.SetParent(prayerSpot.transform);
		//this.transform.localPosition = prayerSpot.CultistSpot.localPosition;
		this.transform.localPosition = new Vector3(0f, -0.5f, 0f);

		if(GameController.Instance.Altar.transform.position.x > this.transform.position.x)
		{
			Vector3 newScale = this.transform.localScale;
			newScale.x = 1f;
			this.transform.localScale = newScale;
		}
		else
		{
			Vector3 newScale = this.transform.localScale;
			newScale.x = -1f;
			this.transform.localScale = newScale;
		}

		GetComponent<AudioSource>().Play();

		villagerAnimations.AnimationPray();

		if(GameController.Instance.PlayerCharacter != null)
			GameController.Instance.PlayerCharacter.RemoveVillagerFromColliding(this);
	}