Exemplo n.º 1
0
 private void Awake()
 {
     damagedColor          = damagedBarImage.color;
     damagedColor.a        = 0f;
     damagedBarImage.color = damagedColor;
     livingObject          = transform.root.GetComponent <LivingObject>(); // 최상위 오브젝트의 LivingObject 가져오기
 }
Exemplo n.º 2
0
    void SpawnBoss()
    {
        //foreach(Wave wave in waveList)
        //wave.Wipe(false);

        config.wavesLoopCount = 0;

        foreach (Transform trans in GameManager.instance.bossPrefabs)
        {
            if (config.bossName == trans.name.Replace("_Prefab", ""))
            {
                Vector2 center = Functions.RectCenter(GameManager.player.sceneCamera.Constrains);
                float   x      = center.x;

                Transform spawn = (Transform)Instantiate(trans, new Vector3(x, layerHeight,
                                                                            GameManager.player.transform.position.z + bossSpawnTreshhold), Quaternion.identity);

                spawn.parent = enemies.transform;

                LivingObject boss = spawn.GetComponent <LivingObject>();
                boss.OnObjectDied += OnBossDied;

                bossActive = true;
                break;
            }
        }
    }
Exemplo n.º 3
0
    void OnPickUp(LivingObject sender)
    {
        PickUp pickup = (PickUp)sender;

        if (!GameManager.instance.config.achievementSave.fullyEquipped.Contains(pickup.pickUpType))
        {
            GameManager.instance.config.achievementSave.fullyEquipped.Add(pickup.pickUpType);
        }

        GameManager.instance.pickedUpPowerUp = true;

        switch (pickup.pickUpType)
        {
        case PickUpType.Health:
        {
            //if(GameManager.player.health < 3)
            GameManager.player.health++;

            break;
        }

        case PickUpType.GunSpread:
        {
            GameManager.player.weaponType = WeaponType.DoubleBlaster;

            break;
        }
        }

        if (config.loopPickUps)
        {
            GameManager.timer.Add("Level_PickUpLoop_" + pickup.RandomName, config.loopPickUpsDelay, false, false, delegate(){ PickUpLoop(pickup); });
        }
    }
Exemplo n.º 4
0
        public static void AddRandomArmor(LivingObject living, ArmorSlot slot)
        {
            var itemIDs = Items.GetItemInfos(ItemCategory.Armor).Where(ii => ii.ArmorInfo.Slot == slot).ToArray();
            var itemID  = itemIDs[Helpers.GetRandomInt(itemIDs.Length)].ID;

            AddEquipment(living, itemID);
        }
 public override void handleAttackCommand(LivingObject actor)
 {
     if (actor is CreatureObject)
     {
         (actor as CreatureObject).attack();
     }
 }
Exemplo n.º 6
0
        public static void AddRandomWeapon(LivingObject living)
        {
            var itemIDs = Items.GetItemInfos(ItemCategory.Weapon).ToArray();
            var itemID  = itemIDs[Helpers.GetRandomInt(itemIDs.Length)].ID;

            AddEquipment(living, itemID);
        }
Exemplo n.º 7
0
    public override void Die(LivingObject sender)
    {
        base.Die(sender);

        if (sender != null && sender.GetType() == typeof(Player))
        {
            GameManager.instance.playerScore += 10000;
        }

        foreach (Transform trans in spawnedChildList)
        {
            if (trans == null)
            {
                continue;
            }

            LivingObject obj = trans.GetComponent <LivingObject>();
            if (obj != null)
            {
                obj.Die(sender);
            }
        }

        if (GameManager.instance.config.gameOptions.effectEnabled)
        {
            Instantiate(explosion, transform.position, transform.rotation);
        }

        Functions.PlayAudioClip(transform.position, exposionSound);

        Destroy(gameObject);
        Destroy(bezierCurveManagers.gameObject);
        Destroy(mineChildSpawnPoints[0].gameObject);
    }
Exemplo n.º 8
0
    // 어택 애니메이션
    protected IEnumerator AttackAnimation(LivingObject livingObject)
    {
        isAttack = true;
        Vector3 originglPosition = transform.position;
        Vector3 dirToTarget      = (livingObject.transform.position - transform.position).normalized; // 타겟으로의 벡터
        Vector3 attackPosition   = livingObject.transform.position - dirToTarget * 0.5f;              // 에너미가 타겟 표면 조금 안까지 닿게 함.

        float attackSpeed = 3;                                                                        //공격 속도, 높을수록 빨라짐
        float percent     = 0;                                                                        // 0~1까지의 값을 가짐

        Color originColor = material.color;

        material.color = Color.red;

        while (percent <= 1)
        {
            percent += Time.deltaTime * attackSpeed;
            // 공격 후에 돌아가야 하기 때문에 대칭함수를 보간값으로 사용.
            // y = 4(-(x^2) + x) 0에서 출발 0.5에서 1, 1에 0으로 돌아옴. - 구글에 검색하면 곡선 이미지를 보여줌.
            // 보간 - 알려진 점들의 위치를 참조하여, 집합의 일정 범위의 점들(선)을 새롭게 그리는 방법.
            // Lerp 메소드는 두 벡터 사이에 비례값 (0~1 사이) 으로 내분점 지점을 반환함.
            // 0이면 처음 위치 1이면 두번쨰 위치 0.5면 두 위치의 중간값
            float interpolation = (-Mathf.Pow(percent, 2) + percent) * 4;    // 보간
            transform.position = Vector3.Lerp(originglPosition, attackPosition, interpolation);

            yield return(null);  // Update 메소드가 완전히 수행된 이후 매 프레임 마다 실행.
        }
        material.color = originColor;
        isAttack       = false;
        GameManager.Instance.NextTurn();
    }
Exemplo n.º 9
0
    public void OnEnemyDied(LivingObject sender)
    {
        if (isResetting)
        {
            return;
        }

        int index = enemyList.IndexOf((Enemy)sender);

        if (index >= 0)
        {
            enemyList[index] = null;
        }

        if (IsWiped)
        {
            if (OnWaveWiped != null)
            {
                OnWaveWiped(this);
                OnWaveWiped = null;
            }

            Destroy(gameObject);
        }
    }
 public override void handleAttackCommand(LivingObject actor)
 {
     actor.attack();//actor.attackLivingObject(null, 0); //TODO: Noch Response einbauen, dass Attackanimation nur dann gestartet wird, wenn ein Objekt getroffen wurde
     if (!Configuration.isSinglePlayer)
     {
         Configuration.networkManager.addEvent(new GameLibrary.Connection.Message.PlayerCommandMessage(actor as PlayerObject, ECommandType.AttackCommand), GameMessageImportance.VeryImportant);
     }
 }
Exemplo n.º 11
0
 protected override void preformAttack(LivingObject target)
 {
     this.unit.map.fireProjectile(
         this.unit.transform.position,
         this.unit,
         this.unit.getAttackAmount(),
         target);
 }
Exemplo n.º 12
0
 public static void AddBattleGear(LivingObject living)
 {
     Helpers.AddRandomWeapon(living);
     Helpers.AddRandomArmor(living, ArmorSlot.Torso);
     Helpers.AddRandomArmor(living, ArmorSlot.Head);
     Helpers.AddRandomArmor(living, ArmorSlot.Hands);
     Helpers.AddRandomArmor(living, ArmorSlot.Feet);
 }
Exemplo n.º 13
0
    void OnPickUpFailed(LivingObject sender)
    {
        PickUp pickup = (PickUp)sender;

        if (config.loopPickUps)
        {
            GameManager.timer.Add("Level_PickUpLoop_" + pickup.RandomName, config.loopPickUpsDelay, false, false, delegate(){ PickUpLoop(pickup); });
        }
    }
Exemplo n.º 14
0
    public virtual void Die(LivingObject sender)
    {
        if (OnObjectDied != null)
        {
            OnObjectDied(this);
        }

        OnObjectDied = null;
    }
Exemplo n.º 15
0
 public virtual LivingObject attack(LivingObject target)
 {
     if (Time.time >= (this.lastAttack + this.getAttackRate()) && this.inRangeToAttack(target))
     {
         this.preformAttack(target);
         this.lastAttack = Time.time;
     }
     return(target);
 }
Exemplo n.º 16
0
    public override void Die(LivingObject sender)
    {
        if (sender != null && sender.GetType() == typeof(Player))
        {
            //
        }

        Destroy(gameObject);
    }
Exemplo n.º 17
0
        public override void readFromNbt(NbtCompound tag)
        {
            base.readFromNbt(tag);

            this.damage = tag.getInt("damageDelt");
            this.target = (LivingObject)this.map.findMapObjectFromGuid(tag.getGuid("target"));
            Guid guid = tag.getGuid("shooter");

            this.shooter = (SidedObjectEntity)(guid != Guid.Empty ? this.map.findMapObjectFromGuid(guid) : null);
        }
Exemplo n.º 18
0
    public void specificAttack(MessageAttackSpecific msg)
    {
        UnitBase     unit   = this.map.findMapObjectFromGuid <UnitBase>(msg.attackerGuid);
        LivingObject target = this.map.findMapObjectFromGuid <LivingObject>(msg.targetGuid);

        if (unit != null && target != null)
        {
            unit.setTask(new TaskAttackNearby(unit, target));
        }
    }
Exemplo n.º 19
0
 void mineChildDied(LivingObject sender)
 {
     if (sender.transform.rotation.y < 0)
     {
         mineDroperChildLeftAlive = false;
     }
     else
     {
         mineDroperChildRightAlive = false;
     }
 }
Exemplo n.º 20
0
    public void addHealthBar(LivingObject boss)
    {
        GameObject g = GameObject.Instantiate(Resources.Load("healthBar", typeof(GameObject))) as GameObject;

        g.transform.parent     = m_uipanel.transform;
        g.transform.localScale = Vector3.one;
        HealthBar h = g.GetComponent <HealthBar> ();

        h.boss     = boss;
        h.thisType = HealthBar.objType.boss;
    }
 public override void handleWalkRightCommand(LivingObject actor)
 {
     if (!actor.MoveRight)
     {
         actor.MoveRight = true;
         if (!Configuration.isSinglePlayer)
         {
             Configuration.networkManager.addEvent(new GameLibrary.Connection.Message.PlayerCommandMessage(actor as PlayerObject, ECommandType.WalkRightCommand), GameMessageImportance.VeryImportant);
         }
     }
 }
 public override void stopWalkLeftCommand(LivingObject actor)
 {
     if (actor.MoveLeft)
     {
         actor.MoveLeft = false;
         if (!Configuration.isSinglePlayer)
         {
             Configuration.networkManager.addEvent(new GameLibrary.Connection.Message.PlayerCommandMessage(actor as PlayerObject, ECommandType.StopWalkLeftCommand), GameMessageImportance.VeryImportant);
         }
     }
 }
Exemplo n.º 23
0
        static bool OnLevel(WorldClient client, string input)
        {
            if (client.Player.AccessLvl < ACCESSLEVEL.TEMPGM)
            {
                Chat.System(client, "You do not have access to this command");
                return(true);
            }
            string[] split = input.Split(' ');
            if (split.Length != 2)
            {
                return(false);
            }
            int level = 0;

            try
            {
                if (split[1].StartsWith("0x"))
                {
                    level = int.Parse(split[1].Substring(2), System.Globalization.NumberStyles.HexNumber);
                }
                else
                {
                    level = int.Parse(split[1]);
                }
            }
            catch (Exception)
            {
                Chat.System(client, "Invalid level.");
                return(true);
            }

            if (level < 1 | level > 255)
            {
                Chat.System(client, "level must be between 1 and 255!");
                return(true);
            }

            if (client.Player.Selection == null)
            {
                Chat.System(client, "You must have a valid object targeted!");
                return(true);
            }

            LivingObject mob      = ((LivingObject)client.Player.Selection);
            string       mob_name = mob.Name;

            Chat.System(client, "Setting " + mob_name + " ( " + client.Player.Selection.GUID + " )  level to " + level);
            mob.Level = level;
            StatManager.CalculateNewStats(mob);
            mob.Health = mob.MaxHealth;
            mob.Power  = mob.MaxPower;
            mob.UpdateData();
            return(true);
        }
Exemplo n.º 24
0
        public void moveOnPath(LivingObject _LivingObject)
        {
            if (!this.finished && this.pathNodes != null)
            {
                if (_LivingObject.CurrentBlock != null)
                {
                    PathNode var_NextNode = this.getNextNode();
                    if (var_NextNode != null)
                    {
                        if (_LivingObject == null || var_NextNode == null || var_NextNode.block == null)
                        {
                            return;
                        }

                        if (this.isInRange(new Vector2(_LivingObject.Position.X, _LivingObject.Position.Y), new Vector2(var_NextNode.block.Position.X + 16, var_NextNode.block.Position.Y + 16), (int)_LivingObject.MovementSpeed * 15))
                        {
                            var_NextNode = this.extractFirst();
                        }

                        if (var_NextNode != null)
                        {
                            _LivingObject.MoveRight = false;
                            _LivingObject.MoveLeft  = false;
                            _LivingObject.MoveDown  = false;
                            _LivingObject.MoveUp    = false;
                            if (var_NextNode.block.Position.X + 16 > _LivingObject.Position.X)
                            {
                                _LivingObject.MoveRight = true;
                            }
                            else if (var_NextNode.block.Position.X + 16 < _LivingObject.Position.X)
                            {
                                _LivingObject.MoveLeft = true;
                            }
                            if (var_NextNode.block.Position.Y + 16 > _LivingObject.Position.Y)
                            {
                                _LivingObject.MoveDown = true;
                            }
                            else if (var_NextNode.block.Position.Y + 16 < _LivingObject.Position.Y)
                            {
                                _LivingObject.MoveUp = true;
                            }
                        }
                        else
                        {
                            this.finished = true;
                        }
                    }
                    else
                    {
                        this.finished = true;
                    }
                }
            }
        }
Exemplo n.º 25
0
        public static void AddGem(LivingObject living)
        {
            var world = living.World;

            var materials = Materials.GetMaterials(MaterialCategory.Gem).ToArray();
            var material  = materials[Helpers.GetRandomInt(materials.Length)].ID;

            var itemBuilder = new ItemObjectBuilder(ItemID.Gem, material);
            var item        = itemBuilder.Create(world);

            item.MoveToMustSucceed(living);
        }
Exemplo n.º 26
0
    private static GameObject generateScarab(Vector2 pos, out LivingObject living)
    {
        float      xPos  = offset_x / 2f + Tile_Width * pos.x;
        float      yPos  = offset_y / 2f - Tile_Height * pos.y;
        GameObject newGo = GameObject.Instantiate(Resources.Load("Prefab/Scarab")) as GameObject;

        newGo.transform.position   = new Vector3(xPos, yPos, -2);
        newGo.transform.localScale = new Vector3(Tile_Width, Tile_Height, 1);
        living        = newGo.AddComponent <LivingObject>();
        living.bodyGo = newGo;
        return(newGo);
    }
Exemplo n.º 27
0
 public override void doInteraction(LivingObject _Interactor)
 {
     base.doInteraction(_Interactor);
     if (this.isOpen)
     {
         this.closeChest();
     }
     else
     {
         this.openChest();
     }
 }
Exemplo n.º 28
0
 public override void doInteraction(LivingObject _Interactor)
 {
     base.doInteraction(_Interactor);
     if (this.isOpen)
     {
         this.closeChest();
     }
     else
     {
         this.openChest();
     }
 }
Exemplo n.º 29
0
 public TaskAttackNearby(UnitBase unit, LivingObject attackTarget = null) : base(unit)
 {
     if (attackTarget != null)
     {
         this.target          = attackTarget;
         this.ignoreDistances = true;
     }
     else
     {
         this.target = this.findTarget();
     }
 }
Exemplo n.º 30
0
 /// <summary>
 /// Attacks the target if they are in range, or continues to move if they are not in range.
 /// </summary>
 protected void func()
 {
     if (this.unit.attack.inRangeToAttack(this.target))
     {
         this.target = this.unit.attack.attack(this.target);
         this.moveHelper.stop();
     }
     else
     {
         this.moveHelper.setDestination(this.target);
     }
 }
Exemplo n.º 31
0
    public void Launch(Vector3 direction, LivingObject caster, IRangedAttacker iRangedAttacker)
    {
        BulletController bulletClone;

        Transform  barrelTip = iRangedAttacker.BarrelTip;
        Vector3    position  = barrelTip.position;
        Quaternion rotation  = barrelTip.rotation;

        bulletClone = (BulletController)Instantiate(this, position, rotation);
        bulletClone.GetComponent <Rigidbody> ().velocity = direction.normalized * bulletSpeed;
        bulletClone.caster = caster;
        Destroy(bulletClone.gameObject, timeSpan);
    }
Exemplo n.º 32
0
 public AttackRandomTask(SerializationInfo info, StreamingContext ctxt)
     : base(info, ctxt)
 {
     wantToDoTaskCheck = true;
     int targetId = (int)info.GetValue("targetId", typeof(int));
     if (targetId >= 0)
     {
         this.target = World.world.getObject(targetId) as LivingObject;
     }
     else
     {
         this.target = null;
     }
 }
Exemplo n.º 33
0
 public WalkRandomTask(LivingObject _TaskOwner, TaskPriority _Priority)
     : base(_TaskOwner, _Priority)
 {
     this.finishedWalking = false;
     targetPosition = new Vector2(Utility.Random.GenerateGoodRandomNumber((int)(this.TaskOwner.Position.X - Chunk.chunkSizeX * Block.BlockSize / 2), (int)(this.TaskOwner.Position.X + Chunk.chunkSizeX * Block.BlockSize / 2)), Utility.Random.GenerateGoodRandomNumber((int)(this.TaskOwner.Position.X - Chunk.chunkSizeX * Block.BlockSize / 2), (int)(this.TaskOwner.Position.X + Chunk.chunkSizeX * Block.BlockSize / 2)));
     this.TaskOwner.Path = createPath(new Vector2(this.TaskOwner.Position.X, this.TaskOwner.Position.Y), new Vector2(this.targetPosition.X, this.targetPosition.Y));
     int counter = 1;
     while (!isPathPossible() && counter >= 0)
     {
         targetPosition = new Vector2(Utility.Random.GenerateGoodRandomNumber((int)(this.TaskOwner.Position.X - Chunk.chunkSizeX * Block.BlockSize / 2), (int)(this.TaskOwner.Position.X + Chunk.chunkSizeX * Block.BlockSize / 2)), Utility.Random.GenerateGoodRandomNumber((int)(this.TaskOwner.Position.X - Chunk.chunkSizeX * Block.BlockSize / 2), (int)(this.TaskOwner.Position.X + Chunk.chunkSizeX * Block.BlockSize / 2)));
         this.TaskOwner.Path = createPath(new Vector2(this.TaskOwner.Position.X, this.TaskOwner.Position.Y), new Vector2(this.targetPosition.X, this.targetPosition.Y));
         counter--;
     }
 }
Exemplo n.º 34
0
		void OnFocusedObjectChanged(LivingObject oldOb, LivingObject newOb)
		{
			if (oldOb != null)
				oldOb.ObjectMoved -= OnFocusedControllableMoved;

			if (newOb != null)
			{
				newOb.ObjectMoved += OnFocusedControllableMoved;
				this.FocusedTileView.SetTarget(newOb.Environment, newOb.Location);
			}
			else
			{
				this.FocusedTileView.ClearTarget();
			}

			// always follow the focused ob for now
			this.FollowObject = newOb;
		}
Exemplo n.º 35
0
 public LivingObjectInteraction(LivingObject _InteractionOwner)
 {
     this.interactionOwner = _InteractionOwner;
 }
Exemplo n.º 36
0
    void Start()
    {
        playerEnt = FindObjectOfType<Player>();
        playerT = playerEnt.transform;

        nextCamperCheckTime = timeEntreCamperChecks + Time.time;
        camperPositionAnt = playerT.position;
        playerEnt.OnDeath += OnPlayerDeath;
        map = FindObjectOfType<MapGenerator>();
        NextWave ();
    }
Exemplo n.º 37
0
 static char MapLivingObjectToChar(LivingObject item)
 {
     if (item == null)
         return ' ';
     if (item is Wall)
     {
         Wall wall = item as Wall;
         return wall.WallType == WallType.Undestructible ? '█' : '.';
     }
     if (item is Player)
         return 'x';
     if (item is Bomb)
         return '*';
     if (item is Bonus)
         return '=';
     return '?';
 }
Exemplo n.º 38
0
 public ChestInteraction(LivingObject _InteractionOwner)
     : base(_InteractionOwner)
 {
     this.isOpen = false;
 }
Exemplo n.º 39
0
 public LivingObjectTask(LivingObject _TaskOwner, Tasks.TaskPriority _Priority)
 {
     this.taskOwner = _TaskOwner;
     this.priority = _Priority;
 }
Exemplo n.º 40
0
 public virtual void doInteraction(LivingObject _Interactor)
 {
 }
Exemplo n.º 41
0
 public StandTask(LivingObject _TaskOwner, TaskPriority _Priority)
     : base(_TaskOwner, _Priority)
 {
 }
Exemplo n.º 42
0
    void Awake()
    {
        //anim = GetComponent<Animator>();
        pathFinder = GetComponent<NavMeshAgent>();
        if (GameObject.FindGameObjectWithTag("Player")!=null){
            hasTarget = true;

            target = GameObject.FindGameObjectWithTag("Player").transform;
            targetObject = target.GetComponent<LivingObject>();

            enemyCollisionRadius = GetComponent<CapsuleCollider>().radius;
            targetCollisionRadius = target.GetComponent<CapsuleCollider>().radius;
        }
    }
Exemplo n.º 43
0
 public AttackRandomTask(LivingObject _TaskOwner, TaskPriority _Priority)
     : base(_TaskOwner, _Priority)
 {
     target = null;
 }
Exemplo n.º 44
0
        public override void update()
        {
            base.update();

            this.attackSpeed -= 1;

            if (this.target == null)
            {
                if (this.updateTarget > 0)
                {
                    this.updateTarget--;
                }
                else
                {
                    List<Object> var_Objects = Model.Map.World.World.world.getObjectsInRange(this.TaskOwner.Position, this.TaskOwner.AggroRange);
                    var_Objects.Remove(this.TaskOwner);
                    if (var_Objects.Count > 0)
                    {
                        foreach (Object var_Object in var_Objects)
                        {
                            if (var_Object is LivingObject)
                            {
                                this.TaskOwner.AggroSystem.addAggro((LivingObject)var_Object, this.TaskOwner.AggroRange - Vector3.Distance(this.TaskOwner.Position, var_Object.Position));
                            }
                        }
                        target = this.TaskOwner.AggroSystem.getTarget();
                        if (target == this.TaskOwner)
                        {
                            Logger.Logger.LogDeb("AttackTask->update(): Target is TaskOwner: Should not be possible!");
                            target = null;
                        }
                    }
                    var_Objects.Clear();
                    this.target = this.TaskOwner.AggroSystem.getTarget();
                    this.updateTarget = this.updateTargetMax;
                }
            }
            else
            {
                if (target.IsDead)
                {
                    List<Object> var_Objects = Model.Map.World.World.world.getObjectsInRange(this.TaskOwner.Position, this.TaskOwner.AggroRange);
                    var_Objects.Remove(this.TaskOwner);
                    if (var_Objects.Count > 0)
                    {
                        foreach (Object var_Object in var_Objects)
                        {
                            if (var_Object is LivingObject)
                            {
                                this.TaskOwner.AggroSystem.addAggro((LivingObject)var_Object, this.TaskOwner.AggroRange - Vector3.Distance(this.TaskOwner.Position, var_Object.Position));
                            }
                        }
                        target = this.TaskOwner.AggroSystem.getTarget();
                        if (target == this.TaskOwner)
                        {
                            Logger.Logger.LogDeb("AttackTask->update(): Target is TaskOwner: Should not be possible!");
                            target = null;
                        }
                    }
                    var_Objects.Clear();
                }
            }
            if(target!=null)
            {
                target = this.TaskOwner.AggroSystem.getTarget();
                if (target == null || target.IsDead)
                {
                    target = null;
                    return;
                }
                if (this.updatePathToTarget > 0)
                {
                    this.updatePathToTarget--;
                }
                else
                {

                    /*System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();

                    float var_TimeAStar = 0;
                    float var_TimeJPS = 0;

                    int var_Count = 50;

                    watch.Start();
                    {
                        for (int i = 0; i < var_Count; i++)
                        {
                            this.TaskOwner.Path = GameLibrary.Model.Path.PathFinderAStar.generatePath(new Vector2(this.TaskOwner.Position.X, this.TaskOwner.Position.Y), new Vector2(this.target.Position.X, this.target.Position.Y));
                        }
                    }
                    watch.Stop();

                    var_TimeAStar = watch.ElapsedMilliseconds;// / var_Count;

                    watch = new System.Diagnostics.Stopwatch();
                    watch.Start();
                    {
                        for (int i = 0; i < var_Count; i++)
                        {
                            this.TaskOwner.Path = GameLibrary.Model.Path.PathFinderJPS.generatePath(new Vector2(this.TaskOwner.Position.X, this.TaskOwner.Position.Y), new Vector2(this.target.Position.X, this.target.Position.Y));
                        }
                    }
                    watch.Stop();

                    var_TimeJPS = watch.ElapsedMilliseconds;// / var_Count;

                    Console.WriteLine("Time AStar: " + var_TimeAStar + "MS : Time JPS: " +var_TimeJPS);
                    //AStar scheint schneller. VLL mal beides kombinieren :) AStar+JPS
                    //Bzw JPS noch optmieren :/
                     */

                    this.TaskOwner.Path = GameLibrary.Model.Path.PathFinderAStar.generatePath(new Vector2(this.TaskOwner.Position.X, this.TaskOwner.Position.Y), new Vector2(this.target.Position.X, this.target.Position.Y));

                    if (this.TaskOwner.Path != null)
                    {

                    }
                    this.updatePathToTarget = this.updatePathToTargetMax;
                }

                /*
                this.TaskOwner.MoveRight = false;
                this.TaskOwner.MoveLeft = false;
                this.TaskOwner.MoveDown = false;
                this.TaskOwner.MoveUp = false;
                if (this.target.Position.X > this.TaskOwner.Position.X + Map.Block.Block.BlockSize)
                {
                    this.TaskOwner.MoveRight = true;
                }
                else if (this.target.Position.X < this.TaskOwner.Position.X - Map.Block.Block.BlockSize)
                {
                    this.TaskOwner.MoveLeft = true;
                }
                if (this.target.Position.Y > this.TaskOwner.Position.Y + Map.Block.Block.BlockSize)
                {
                    this.TaskOwner.MoveDown = true;
                }
                else if (this.target.Position.Y < this.TaskOwner.Position.Y - Map.Block.Block.BlockSize)
                {
                    this.TaskOwner.MoveUp = true;
                }

                if (!this.TaskOwner.MoveRight && !this.TaskOwner.MoveLeft && !this.TaskOwner.MoveDown && !this.TaskOwner.MoveUp)
                {
                    if (attackSpeed <= 0)
                    {
                        this.TaskOwner.attack();
                        this.attackSpeed = this.attackSpeedMax;
                    }
                }
                */

                if (Vector3.Distance(this.TaskOwner.Position, this.target.Position) <= 60)
                {
                    if (attackSpeed <= 0)
                    {
                        this.TaskOwner.attack();
                        this.attackSpeed = this.attackSpeedMax;
                    }
                }
            }
        }