Наследование: MonoBehaviour
Пример #1
1
		private void InitContents( BarrelType type )
		{
			Item item = null;
			byte count = (byte)Utility.RandomMinMax( 10, 30 );

			for( byte i = 0; i < count; i++ )
			{
				switch( type )
				{
					default:
					case BarrelType.Arrows: item = new Arrow( Utility.RandomMinMax( 2, 6 ) ); break;
					case BarrelType.Bolts: item = new Bolt( Utility.RandomMinMax( 2, 6 ) ); break;
					case BarrelType.Farming:
						{
							if( i > 3 )
								return;

							switch( Utility.Random( 3 ) )
							{
								case 0: item = new Shovel(); break;
								case 1: item = new Scythe(); break;
								case 2: item = new Pitchfork(); break;
							}
							break;
						}
					case BarrelType.LargeMining:
						{
							if( i > 5 )
								return;

							switch( Utility.Random( 5 ) )
							{
								case 0: item = new Pitchfork(); break;
								case 1:
								case 2: item = new Shovel(); break;
								case 3:
								case 4: item = new Pickaxe(); break;
							}
							break;
						}
					case BarrelType.LargeWeapon1:
					case BarrelType.LargeWeapon2:
					case BarrelType.LargeWeapon3:
						{
							if( i > 6 )
								return;

							switch( Utility.Random( 6 ) )
							{
								case 0: item = new Spear(); break;
								case 1: item = new Halberd(); break;
								case 2: item = new Axe(); break;
								case 3: item = new ThinLongsword(); break;
								case 4: item = new WarAxe(); break;
								case 5: item = new VikingSword(); break;
							}
							break;
						}
					case BarrelType.Mining:
						{
							if( i > 3 )
								return;

							item = new Pickaxe();
							break;
						}
					case BarrelType.Spears:
						{
							if( i > 4 )
								return;

							item = new Spear();
							break;
						}
					case BarrelType.Weapons:
						{
							if( i > 3 )
								return;

							switch( Utility.Random( 3 ) )
							{
								case 0: item = new WarAxe(); break;
								case 1: item = new WarMace(); break;
								case 2: item = new Maul(); break;
							}
							break;
						}
				}

				if( item != null )
					DropItem( item );
			}
		}
 public static Spear Read(Spear weapon, ref BinaryReader reader)
 {
     weapon = PhysicalObjectHandler.Read(weapon, ref reader);
     weapon.changeDirCounter       = reader.ReadInt32();
     weapon.closestCritDist        = reader.ReadSingle();
     weapon.exitThrownModeSpeed    = reader.ReadSingle();
     weapon.firstFrameTraceFromPos = Vector2NHandler.Read(ref reader);
     //Weapon.Mode lastMode = (Weapon.Mode)reader.ReadInt32();
     Weapon.Mode mode = (Weapon.Mode)reader.ReadInt32();
     if (mode != weapon.mode)
     {
         //weapon.ChangeOverlap(true);
         weapon.ChangeMode(mode);
     }
     if (mode == Weapon.Mode.Thrown && weapon.grabbedBy.Count > 0)
     {
         weapon.AllGraspsLetGoOfThisObject(false);
     }
     //weapon.lastMode = lastMode;
     weapon.mode                    = mode;
     weapon.rotation                = Vector2Handler.Read(ref reader);
     weapon.rotationSpeed           = reader.ReadSingle();
     weapon.throwModeFrames         = reader.ReadInt32();
     weapon.thrownBy                = DistHandler.ReadCreature(ref weapon.thrownBy, ref reader, weapon.room);
     weapon.thrownClosestToCreature = DistHandler.ReadCreature(ref weapon.thrownClosestToCreature, ref reader, weapon.room);
     weapon.thrownPos               = Vector2Handler.Read(ref reader);
     return(weapon);
 }
Пример #3
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.S))
        {
            Spear s = GetSpear();
            if (s != null)
            {
                s.Fire(Launcher.up, 30f);
            }
        }

        if (Move)
        {
            float z = Launcher.localEulerAngles.z;
            Launcher.localEulerAngles += Vector3.forward * Speed * Time.deltaTime * direction;

            if (direction == 1)
            {
                if (z > MaxAngle - 1f && z < 180f)
                {
                    direction = -1;
                }
            }
            else
            {
                if (z < 360 - (MaxAngle - 1f) && z > 180f)
                {
                    direction = 1;
                }
            }
        }
    }
Пример #4
0
    public static void Main()
    {
        ICharacter barbarian = new Spear(new Sword(new Dagger(new BaseCharacter())));

        WriteLine("Character description: " + barbarian.GetDescription());
        WriteLine("Character Impact Level: " + barbarian.GetImpactLevel());
    }
Пример #5
0
 //This is necessary and i kid you not, it actually f****d up ONCE without this
 private void OnTriggerStay(Collider other)
 {
     if (itemsInContact.Count == 0)
     {
         Spear spear = other.GetComponent <Spear>();
         if (spear != null)
         {
             if (!itemsInContact.Contains(other.transform))
             {
                 itemsInContact.Add(other.transform);
                 if (itemsInContact.Count == requiredWeight)
                 {
                     if (buttonState == States.released && buttonRequest != Requests.release)
                     {
                         StartCoroutine(AnimatePress(transform.position));
                     }
                     else if (buttonState == States.releasing)
                     {
                         buttonRequest = Requests.press;
                     }
                 }
             }
         }
     }
 }
Пример #6
0
 public override void Attack()
 {
     if (!m_IsPlaced)
     {
         return;
     }
     if (m_AttackDelay <= 0)
     {
         if (m_EnemyTarget != null)
         {
             if (!m_EnemyTarget.active || m_EnemyTarget.GetComponent <AI>().getHealth() <= 0)
             {
                 m_EnemyTarget = null;
                 return;
             }
             MusicHandler.PlaySound(SoundType.SPEAR_THROW);
             m_AttackDelay = DEFAULT_ATTACK_DELAY;
             float      angle = Mathf.Atan2(m_EnemyTarget.transform.position.y - transform.position.y, m_EnemyTarget.transform.position.x - transform.position.x);
             GameObject obj   = SpriteManage.CREATE_SPRITE(SpriteType.SPEAR);
             Debug.Assert(obj);
             obj.transform.position = transform.position;
             Spear spear = obj.GetComponent <Spear>();
             spear.Init(angle, ObjectSide.OUR_SIDE);
         }
         else
         {
             m_AttackDelay = 0;
         }
     }
 }
Пример #7
0
        protected override void InitPlayer(Network_Player player)
        {
            FieldInfo eventRef_swingv = typeof(Spear).GetField("eventRef_swing", BindingFlags.NonPublic | BindingFlags.Instance);

            Spear spear = player.gameObject.AddComponent <Spear>();

            spear.name       = fullName;
            spear.attackMask = player.GetComponentsInChildren <Spear>(true)[0].attackMask;
            eventRef_swingv.SetValue(spear, eventRef_swingv.GetValue(player.GetComponentsInChildren <Spear>(true)[0]));
            spear.enabled = false;

            FieldInfo attackRangev = typeof(Spear).GetField("attackRange", BindingFlags.NonPublic | BindingFlags.Instance);
            FieldInfo damagev      = typeof(Spear).GetField("damage", BindingFlags.NonPublic | BindingFlags.Instance);

            attackRangev.SetValue(spear, range);
            damagev.SetValue(spear, damage);

            System.Console.WriteLine(owner.Metadata.ModName + ": Added weapon " + fullName + "; damage=" + damage + ", range=" + range + ", cooldown=" + cooldown);

            //The spear probably stores a parented object that represents the actual mesh

            //foreach (Spear sp in player.GetComponentsInChildren<Spear>())
            //{
            //    System.Console.WriteLine(sp.GetType().ToString());



            //}

            //TODO: Still not useable, find out how it works
            //TODO: Also things that are already weapons should be added here
        }
Пример #8
0
 public void ReturnSpear(Spear spear)
 {
     availableSpearIndexPool.Add(spear.index);
     spear.gameObject.SetActive(false);
     spear.transform.position = new Vector3(0, 0, -1);
     spear.Reset();
 }
    // angle in radian
    public void throwSpear(float angle)
    {
        if (m_Health <= 0)
        {
            return;
        }
        if (m_currentWeapon != null)
        {
            if (m_weaponDelay > 0)
            {
                return;
            }
            if (m_currentWeapon.m_Quantity <= 0)
            {
                return;
            }
            if (m_currentWeapon.m_item == ItemType.SPEAR)
            {
                m_currentWeapon.m_Quantity--;
                m_Weapons.setQuantity(m_currentWeapon);

                GameObject temp  = SpriteManage.CREATE_SPRITE(SpriteType.SPEAR);
                Spear      spear = temp.GetComponent <Spear>();
                spear.transform.position = transform.position;
                spear.Init(angle, ObjectSide.OUR_SIDE);
                MusicHandler.PlaySound(SoundType.SPEAR_THROW);
                m_weaponDelay = AXE_DELAY;
                if (m_currentWeapon.m_Quantity <= 0)
                {
                    changeWeapon(0);
                }
            }
        }
    }
Пример #10
0
    private void ThrowSpear()
    {
        if (heldSpear != null)
        {
            if (Input.GetMouseButton(0))
            {
                if (Force < heldSpear.stats.minForce)
                {
                    Force = heldSpear.stats.minForce;
                }
                else
                {
                    float forceToAdd = ((heldSpear.stats.maxForce - heldSpear.stats.minForce) / heldSpear.stats.chargeTime) * Time.deltaTime;
                    Force += forceToAdd;
                }
                charge = (Force - heldSpear.stats.minForce) / (heldSpear.stats.maxForce - heldSpear.stats.minForce);

                chargedPos = Vector3.back * retractionDistance;
                heldSpear.transform.localPosition = Vector3.Lerp(Vector3.zero, chargedPos, charge);
            }
            else if (Input.GetMouseButtonUp(0))
            {
                Rigidbody spearRB = heldSpear.GetComponent <Rigidbody>();
                heldSpear.transform.parent.DetachChildren();
                spearRB.isKinematic = false;
                spearRB.velocity    = heldSpear.transform.forward * Force;
                heldSpear           = null;
                Force = 0;
            }
        }
    }
Пример #11
0
    private void OnTriggerExit(Collider other)
    {
        Spear spear = other.GetComponent <Spear>();

        if (spear != null)
        {
            if (itemsInContact.Contains(other.transform))
            {
                itemsInContact.Remove(other.transform);
                if (itemsInContact.Count == requiredWeight - 1)
                {
                    if (buttonState == States.pressed && buttonRequest != Requests.press)
                    {
                        StartCoroutine(AnimateRelease(transform.position));
                    }
                    else if (buttonState == States.pressing)
                    {
                        buttonRequest = Requests.release;
                    }
                    else if (buttonState == States.releasing)
                    {
                        buttonRequest = Requests.nothing;
                    }
                }
            }
        }
    }
Пример #12
0
        public DummyFence() : base(AIType.AI_Melee, FightMode.Closest, 15, 1, 0.2, 0.6)
        {
            // A Dummy Fencer
            int iHue = 20 + Team * 40;

//			int jHue = 25 + Team * 40;

            // Skills and Stats
            this.InitStats(125, 125, 90);
            this.Skills[SkillName.Fencing].Base = 120;
            this.Skills[SkillName.Anatomy].Base = 120;
            this.Skills[SkillName.Healing].Base = 120;
            this.Skills[SkillName.Tactics].Base = 120;

            // Name
            this.Name = "Fencer";

            // Equip
            Spear ssp = new Spear();

            ssp.Movable = true;
            ssp.Crafter = this;
            ssp.Quality = WeaponQuality.Regular;
            AddItem(ssp);

            Boots snd = new Boots();

            snd.Hue      = iHue;
            snd.LootType = LootType.Newbied;
            AddItem(snd);

            ChainChest cht = new ChainChest();

            cht.Movable  = false;
            cht.LootType = LootType.Newbied;
            cht.Crafter  = this;
            cht.Quality  = ArmorQuality.Regular;
            AddItem(cht);

            ChainLegs chl = new ChainLegs();

            chl.Movable  = false;
            chl.LootType = LootType.Newbied;
            chl.Crafter  = this;
            chl.Quality  = ArmorQuality.Regular;
            AddItem(chl);

            PlateArms pla = new PlateArms();

            pla.Movable  = false;
            pla.LootType = LootType.Newbied;
            pla.Crafter  = this;
            pla.Quality  = ArmorQuality.Regular;
            AddItem(pla);

            Bandage band = new Bandage(50);

            AddToBackpack(band);
        }
Пример #13
0
 public Hastati() : base()
 {
     s     = new Spear();
     name  = "Hastati";
     speed = 2;
     Defense();
     attack = s.Attack();
 }
Пример #14
0
    public void ThrowSpear()
    {
        Vector2 velocity  = new Vector2(anim.GetFloat("LastMoveX"), anim.GetFloat("LastMoveY"));
        Spear   spear     = Instantiate(throwableSpear, throwingPoint.transform.position, Quaternion.identity).GetComponent <Spear>();
        float   zRotation = Mathf.Atan2(-anim.GetFloat("LastMoveX"), anim.GetFloat("LastMoveY")) * Mathf.Rad2Deg;

        spear.Setup(velocity, new Vector3(0, 0, zRotation));
    }
Пример #15
0
 public void EquipSpear(Spear s)
 {
     rb_spear             = s.rb;
     rb_spear.constraints = RigidbodyConstraints2D.None;
     _spear             = s;
     _spear.spearState  = Spear.SpearState.Holding;
     _spear.box.enabled = false;
     SwitchSpears();
 }
Пример #16
0
 void SpearTaken(Spear spear)
 {
     if (spears.Contains(spear) && spearsLeft > 0)
     {
         spearsLeft--;
         spears.Remove(spear);
         StartCoroutine(Refill());
     }
 }
Пример #17
0
 private static void Spear_LodgeInCreature(On.Spear.orig_LodgeInCreature orig, Spear self, SharedPhysics.CollisionResult result, bool eu)
 {
     //Create an emitter when a create is impaled by a spear
     orig.Invoke(self, result, eu);
     if (self.stuckInChunk != null)
     {
         self.room.AddObject(new BloodEmitter(self, self.stuckInChunk, UnityEngine.Random.Range(5f, 8f), UnityEngine.Random.Range(1f, 3f)));
     }
 }
 public void OnHit(Spear spear)
 {
     ExitCurrentState();
     GameObject player = GameObject.FindWithTag("Player");
     if(player != null){
         player.SendMessage("OnHunted");
         EnterHunting(player);
     }
 }
Пример #19
0
        public DummyFence() : base(AIType.AI_Melee, FightMode.Closest, 15, 1, 0.2, 0.6)
        {
            // A Dummy Fencer
            var iHue = 20 + Team * 40;
            var jHue = 25 + Team * 40;

            // Skills and Stats
            InitStats(125, 125, 90);
            Skills.Fencing.Base = 120;
            Skills.Anatomy.Base = 120;
            Skills.Healing.Base = 120;
            Skills.Tactics.Base = 120;

            // Equip
            var ssp = new Spear();

            ssp.Movable = true;
            ssp.Crafter = this;
            ssp.Quality = WeaponQuality.Regular;
            AddItem(ssp);

            var snd = new Boots();

            snd.Hue      = iHue;
            snd.LootType = LootType.Newbied;
            AddItem(snd);

            var cht = new ChainChest();

            cht.Movable  = false;
            cht.LootType = LootType.Newbied;
            cht.Crafter  = this;
            cht.Quality  = ArmorQuality.Regular;
            AddItem(cht);

            var chl = new ChainLegs();

            chl.Movable  = false;
            chl.LootType = LootType.Newbied;
            chl.Crafter  = this;
            chl.Quality  = ArmorQuality.Regular;
            AddItem(chl);

            var pla = new PlateArms();

            pla.Movable  = false;
            pla.LootType = LootType.Newbied;
            pla.Crafter  = this;
            pla.Quality  = ArmorQuality.Regular;
            AddItem(pla);

            var band = new Bandage(50);

            AddToBackpack(band);
        }
Пример #20
0
    protected override void FireWeapon()
    {
        Spear   spear          = Instantiate <Spear>(SpearPrefab, transform.position, Quaternion.identity);
        Vector2 spearDirection = new Vector2 {
            x = (isFlipped ? -1.0f : 1.0f), y = 0
        };

        spear.GetComponent <Rigidbody2D>().AddForce(spearDirection.normalized * 500, ForceMode2D.Force);
        spear.GetComponent <SpriteRenderer>().flipX = !isFlipped;
        Destroy(spear.gameObject, 3.0f);
    }
Пример #21
0
 public static void Write(Spear spear, ref BinaryWriter writer)
 {
     Vector2NHandler.Write(spear.stuckInWall, ref writer);
     WeaponHandler.Write(spear, ref writer);
     writer.Write(spear.alwaysStickInWalls);
     writer.Write(spear.pinToWallCounter);
     writer.Write(spear.spearDamageBonus);
     DistHandler.Write(spear.stuckInObject, ref writer);
     Vector2NHandler.Write(spear.stuckInWall, ref writer);
     writer.Write(spear.stuckRotation);
 }
Пример #22
0
 void OnTriggerEnter2D(Collider2D col)
 {
     if (col.gameObject.tag == "Spear")
     {
         Spear spear = col.gameObject.GetComponentInChildren <Spear>();
         if (spear.LightAttacking)
         {
             DestroyTarget();
         }
     }
 }
Пример #23
0
 public void Shoot()
 {
     if (m_BulletsLeft > 0 && m_CanShoot)
     {
         m_BulletsLeft--;
         Spear bullet = Instantiate(m_SpearPrefab, m_SpearPosition.position, Quaternion.identity).GetComponent <Spear>();
         bullet.Initialize();
         StartCoroutine(ShootEffect());
         UpdateSpearIcon();
     }
 }
    public void ThrowSpear()
    {
        //Create our spear and call the onThrow to intialize it
        Spear s = spear;

        s.OnThrow(character.controller.Collisions.faceDir);

        //Spawn it in the world - the
        GameObject g = Instantiate(s.gameObject, null);

        g.transform.position = spearSpawnPos.position;
    }
Пример #25
0
        public MugdarMineGuardWeak() : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
        {
            Name        = NameList.RandomName("orc");
            Body        = 0x190;
            BaseSoundID = 0x45A;
            Title       = "the Mugdar Tribe Quarry Guard";
            Hue         = Utility.RandomMinMax(2401, 2406);

            SetStr(96, 120);
            SetDex(81, 105);
            SetInt(36, 60);

            SetHits(30, 45);

            SetDamage(5, 7);

            SetDamageType(ResistanceType.Physical, 100);

            SetResistance(ResistanceType.Physical, 25, 30);
            SetResistance(ResistanceType.Fire, 20, 30);
            SetResistance(ResistanceType.Cold, 10, 20);
            SetResistance(ResistanceType.Poison, 10, 20);
            SetResistance(ResistanceType.Energy, 20, 30);

            SetSkill(SkillName.MagicResist, 50.1, 75.0);
            SetSkill(SkillName.Tactics, 55.1, 80.0);
            SetSkill(SkillName.Wrestling, 50.1, 70.0);

            Fame  = 0;
            Karma = 0;

            VirtualArmor = 28;

            OrcishKinMask helm = new OrcishKinMask();

            helm.Hue = this.Hue;
            AddItem(helm);

            Spear spear = new Spear();

            spear.Hue = 0;
            AddItem(spear);

            BoneChest bonechest = new BoneChest();

            bonechest.Hue = 0;
            AddItem(bonechest);

            Sandals sandals = new Sandals();

            sandals.Hue = 0;
            AddItem(sandals);
        }
Пример #26
0
 private void Start()
 {
     Launcher.localScale = Vector3.one * LauncherSize;
     Spears.Clear();
     for (int i = 0; i < SpearCount; i++)
     {
         Spear s = Instantiate(SpearPrefab, SpearContainer).GetComponent <Spear>();
         s.transform.localScale = Vector3.one * SpearSize;
         s.Active = false;
         Spears.Add(s);
     }
 }
Пример #27
0
 public static Spear Read(Spear spear, ref BinaryReader reader)
 {
     spear.stuckInWall = Vector2NHandler.Read(ref reader);
     WeaponHandler.Read(spear, ref reader);
     spear.alwaysStickInWalls = reader.ReadBoolean();
     spear.pinToWallCounter   = reader.ReadInt32();
     spear.spearDamageBonus   = reader.ReadSingle();
     spear.stuckInObject      = DistHandler.ReadPhysicalObject(ref spear.stuckInObject, ref reader, spear.room);
     spear.stuckInWall        = Vector2NHandler.Read(ref reader);
     spear.stuckRotation      = reader.ReadSingle();
     return(spear);
 }
Пример #28
0
 void OnTriggerEnter2D(Collider2D col)
 {
     if (col.gameObject.tag == "Spear")
     {
         Spear spear = col.gameObject.GetComponentInChildren <Spear>();
         if (spear.LightAttacking)
         {
             GameObject particle = Instantiate(particles, transform.position, Quaternion.identity) as GameObject;
             BreakGlass();
         }
     }
 }
Пример #29
0
    public InventorySlot SearchItem(int type, int itemClass)
    { // Return an item, as well as all its properties
        InventorySlot item = new Empty();

        if (itemClass == 0)
        { // Is it a resource?
            switch (type)
            {
            case 0:     // Wood
                item = new Wood();
                break;

            case 1:     // Dirt
                item = new Dirt();
                break;

            case 2:     // Stone
                item = new Stone();
                break;

            case 3:     // Grass
                item = new Grass();
                break;
            }
        }
        else
        { // Is it a tool?
            switch (type)
            {
            case 11:     // Spear
                item = new Spear();
                break;

            case 12:     // Fence
                item = new Fence();
                break;

            case 13:     // CampFire
                item = new CampFire();
                break;

            case 14:     // Rope
                item = new Rope();
                break;

            case 15:     // Hammer
                item = new Hammer();
                break;
            }
        }
        return(item);
    }
Пример #30
0
    public void CreateSpear()                                                             // create a spear at the Hunter's hand across the network
    {
        conjured_spear = Instantiate(spear_go, right_hand.position, Quaternion.identity); // create a new spear
        conjured_spear.transform.up = right_hand.forward;
        conjured_spear.transform.SetParent(right_hand);

        conjured_spear_mat = conjured_spear.GetComponent <Renderer>().material;
        conjured_spear_mat.SetFloat(FADE_NAME, 1);
        spear = conjured_spear.GetComponent <Spear>();

        // disable syncronizing the spear RB when it is held, this prevents the spear from wandering from the hunter's hand on other photon views.
        conjured_spear.GetComponent <PhotonRigidbodyView>().enabled = false;
    }
Пример #31
0
	private void Attack() 
	{
		if ( _canAttack )
		{
			Spear spear = GameObject.Instantiate<Spear>( spearPrefab );
			spear.transform.position = transform.position;
			spear.direction = Elephant.instance.transform.position - transform.position;
			spear.direction.Normalize();

			_canAttack = false;
			Invoke( "OnAttackCooldownComplete", ATTACK_COOLDOWN );
		}
	}
Пример #32
0
        private static Weapon GetWeapon()
        {
            Weapon        weakSpear      = new Spear("Old Spear", 5, 1, 4);
            Weapon        rustyDagger    = new Dagger("Rusty Dagger", 5, 1, 3, false);
            Weapon        PoisonedDagger = new Dagger("Poisoned Dagger", 5, 1, 4, true, 1);
            List <Weapon> weapons        = new List <Weapon>()
            {
                weakSpear,
                rustyDagger,
                PoisonedDagger
            };

            return(weapons[new Random().Next(weapons.Count)]);
        }
 public override void OnHit(Spear spear)
 {
     Transform myAnimatedBody = transform.Find("animatable");
     spear.DecorativeStickOn(myAnimatedBody.gameObject);
 }
Пример #34
0
 public Spear(Spear spear)
     : base(spear)
 {
 }
Пример #35
0
 public override void OnHit(Spear spear)
 {
     base.OnHit(spear);
     Die();
 }
Пример #36
0
 ///// IHittable
 public virtual void OnHit(Spear spear)
 {
     spear.RealisticStickOn(gameObject);
 }
Пример #37
0
 public override void OnHit(Spear spear)
 {
 }
Пример #38
0
 public void OnHit(Spear spear)
 {
 }
Пример #39
0
	private void OnTriggerEnter2D(Collider2D other)
	{
		switch (other.tag)
		{
			case "Next":
				GameManager.instance.LoadNextLevel();
				break;
			case "Death":
				other.gameObject.GetComponent<SpriteRenderer>().sprite = spikeOn;
				StartCoroutine(GameManager.instance.GameOver());
				break;
			case "Flower":
				Destroy(other.gameObject);
				StartCoroutine(UIManager.instance.ShowTooltipMessageWithDelay(Constants.FlowerMessage, 2f));
				SoundManager.instance.PlayPlayersSingle(mmmSound);
				SoundManager.instance.PlayOtherSingle(collectSound);
				PlayerManager.instance.AddFlower(1);
				break;
			case "Fire":
				UIManager.instance.ShowTooltipMessage(Constants.FireMessage);
				SoundManager.instance.PlayPlayersSingle(mmmSound);
				break;
			case "QuestFlower":
				questFlowers--;
				Destroy(other.gameObject);
				SoundManager.instance.PlayOtherSingle(collectSound);

				if (questFlowers <= 0)
				{
					GameManager.instance.questState = Constants.QuestState.Done;
				}
				break;
			case "QuestRoom":
				if (GameManager.instance.questState != Constants.QuestState.Done)
				{
					GameManager.instance.questState = Constants.QuestState.InProgress;
				}

				if (GameManager.instance.isPoisoning) 
				{
					GameManager.instance.StopPoisoning();
				}
				else
				{
					GameManager.instance.StartPoisoning();
				}
				break;
			case "Spear":
				//set spear to temp var on contact with spear to be able to pull it out
				contactedSpear = other.gameObject.GetComponent<Spear>();
                //If player is not pierced with spear - this contact is because spear is stuck somewhere.
                if (!PlayerManager.instance.spearPiercedPlayer)
                {
                    contactsWithSpear = true;
                    UIManager.instance.ShowTooltipMessage("Boobaraka is strong! He can pull it out!");
                }
                //If he has no spear and it is thrown - the Quest 2 and possibly other levels.
                else if (!PlayerManager.instance.hasSpear && !other.gameObject.GetComponent<Spear>().isThrown)
				{
                    PlayerManager.instance.Damage(3);
					other.gameObject.transform.localPosition = new Vector3(other.gameObject.transform.localPosition.x, other.gameObject.transform.localPosition.y, gameObject.transform.position.z + .5f);
					other.gameObject.transform.SetParent(gameObject.transform);
					PlayerManager.instance.spearsInBack.Add(other.gameObject.GetComponent<Spear>());
					PlayerManager.instance.spearPiercedPlayer = true;
				}
                //Set the HUD button to Pull Out state TEMPORARY!!!!! remove after finished with the spear throwing:

                    UIManager.instance.throwSpearButton.gameObject.SetActive(false);
                    UIManager.instance.pullOutSpearButton.gameObject.SetActive(true);

				break;
		case "Wizard":
			SoundManager.instance.PlayOldman ();
			if (TextManager.instance.currentLevel == 2) 
			{
				switch (GameManager.instance.questState) {
				case Constants.QuestState.Done:
					TextManager.instance.branch = 3;
					UIManager.instance.ShowModalDialogPanel ();
					break;
				case Constants.QuestState.None:
					GameManager.instance.questState = Constants.QuestState.Started;
					UIManager.instance.ShowModalDialogPanel ();//"It's quest time! Collect all flowers before you die.", "Ok");
					break;
				case Constants.QuestState.Started:
					UIManager.instance.ShowModalDialogPanel ();
					break;
				case Constants.QuestState.InProgress:
					UIManager.instance.ShowModalDialogPanel ();
					break;
				}
			} 
			else 
			{
				UIManager.instance.ShowModalDialogPanel ();
			}
				break;
			case "Phrase":
				if (!phraseUsed)
				{
					SoundManager.instance.PlayPlayersSingle(manGetTired);
					UIManager.instance.ShowTooltipMessage(phrases[Random.Range(0, phrases.Length)]);
					phraseUsed = true;
				}
				break;
			case "Chest":
				Chest chest = other.GetComponent<Chest>();

				if (!chest.isUsed)
				{
					chest.OpenChest();
				}
				break;
			case "Lock":
				if (PlayerManager.instance.hasKey) 
				{
					GameObject.Find("Lock").SetActive(false);
					UIManager.instance.ShowModalDialogPanel ();//"Why would anyone try to unlock a lock hanging on the stones?", "I don'no...");
					for (int i = 0; i < level3Walls.Length; i++) 
					{
						Destroy (level3Walls[i]);
					}
					GameObject.Find("/Canvas/HUD/KeyImage").SetActive(false); //FIXME: change this to reference GO in the class
				} 
				else 
				{
					UIManager.instance.ShowTooltipMessage("Mmmm? Me don't know what this is.");
				}
			break;
			case "Bat":
				PlayerManager.instance.Damage(3);
				break;
			case "Vampire":
				if (PlayerManager.instance.hasGarlic)
				{
					Destroy(GameManager.instance.vampire);
					for (int i = 0; i < level4Walls.Length; i++) {
						Destroy (level4Walls[i]);
					}
				}
				else
				{
					PlayerManager.instance.Damage(3);
				}
				break;
			case "Princess":
				SoundManager.instance.PlayPlayersSingle (princessSound);
				UIManager.instance.ShowModalDialogPanel ();//"Honey, I knew you would save me. Now face your doom MU-HA-HA-HA-HA", "What?", true);
				GameObject.Find("princess").GetComponent<SpriteRenderer>().sprite = vampire;
				break;
			case "Exit":
				GameManager.instance.StartFromTheBeginning();
				break;
			case "Tablet":
				Tablet tablet = other.GetComponent<Tablet>();
				UIManager.instance.ShowTooltipMessage(tablet.setTabletMessage());
				break;
            default: break;
		}
	}
 public void OnHit(Spear spear)
 {
     pursueStartTime = Time.time;
     state = State.Pursue;
 }