Ejemplo n.º 1
0
 public void OnEndDrag(PointerEventData eventData)
 {
     successful = allSkills.cast(getCardInfo.card, gridGenerator, cardSystem.Player, BattleStatus.Combat, cardSystem.Player.GetComponent <GetStats>()) && this.transform.position.y >= heightUI;
     if (successful)
     {
         getBarInfo.RefreshBar();
         SendMessageUpwards("PlayCard", index);
         gridGenerator.DestroyTiles(DestroyOption.allList, true, true);
     }
     else
     {
         ResetCardPos();
     }
 }
Ejemplo n.º 2
0
 public void OnEndDrag(PointerEventData eventData)
 {
     successful = allSkills.cast(getCardInfo.card, gridGenerator, cardSystem.Player, BattleStatus.PlayerCombat) && this.transform.position.y >= heightUI;
     if (successful)
     {
         skillInfo.SetCardID(getCardInfo.card);
         getBarInfo.RefreshBar();
         SendMessageUpwards("PlayCard", index);
     }
     else
     {
         ResetCardPos();
     }
 }
Ejemplo n.º 3
0
    public void checkRayCast()
    {
        RaycastHit hit;

        if (Physics.Raycast(mainCam.ScreenPointToRay(Input.mousePosition), out hit) && Input.GetMouseButtonDown(0))
        {
            if (hit.collider.gameObject.name == gridGenerator.GetTilePrefabClone().name&& Input.GetMouseButtonDown(0))
            {
                List <GameObject> currentSelectedTiles = gridGenerator.selectedTiles;

                if (allSkills.cast(getStats.character.movementCard, currentSelectedTiles, gridGenerator.rangeTiles, this.gameObject, BattleStatus.Move, getStats))
                {
                    getStats.lastcastedSkill = getStats.character.movementCard;
                    tracked = false;
                }
            }
        }
    }
Ejemplo n.º 4
0
    private void EnemyMove()
    {
        alreadyWent = true;

        int rotation = (360 - (360 - (int)this.transform.localEulerAngles.y)) / 90;

        for (int i = 0; i < 4; i++)
        {
            gridGenerator.GenerateSkillTiles(getStats.character.movementCard.ranges, getStats.character.movementCard.targetType, gameObject, TypesofValue.relative, false);

            tempList.AddRange(gridGenerator.rangeTiles.ToArray());

            RemoveDuplictas(tempList);

            CheckRotation(gameObject);
        }
        gridGenerator.DestroyTiles(DestroyOption.rangeTiles, true, false);

        foreach (GameObject temptile in tempList)
        {
            for (int m = 0; m < 4; m++)
            {
                placeHolder.transform.position = temptile.transform.position;
                gridGenerator.GenerateSkillTiles(usedCard.ranges, usedCard.targetType, placeHolder, TypesofValue.relative, false);
                foreach (GameObject rangeTile in gridGenerator.rangeTiles)
                {
                    if (rangeTile.GetComponent <GetObjectonTile>().gameObjectOnTile != null)
                    {
                        if (rangeTile.GetComponent <GetObjectonTile>().gameObjectOnTile.GetComponent <GetStats>())
                        {
                            gridGenerator.selectedTiles.Add(temptile);
                        }
                    }
                }
                gridGenerator.DestroyTiles(DestroyOption.rangeTiles, true, false);
                CheckRotation(placeHolder);
            }
            placeHolder.transform.localEulerAngles = new Vector3(0, 270, 0);
        }

        playerPos = FindEnemyPos();

        int indexPlayerPos = Random.Range(0, playerPos.Count - 1);

        closestTile      = tempList[0];
        furthermostTile  = tempList[0];
        smallestDistance = Vector3.Distance(closestTile.transform.position, playerPos[indexPlayerPos]);
        largestDistance  = Vector3.Distance(furthermostTile.transform.position, playerPos[indexPlayerPos]);

        foreach (GameObject rangeTile in tempList)
        {
            if (Vector3.Distance(rangeTile.transform.position, playerPos[indexPlayerPos]) < smallestDistance)
            {
                smallestDistance = Vector3.Distance(rangeTile.transform.position, playerPos[indexPlayerPos]);
                closestTile      = rangeTile;
            }
            if (Vector3.Distance(rangeTile.transform.position, playerPos[indexPlayerPos]) > largestDistance)
            {
                largestDistance = Vector3.Distance(rangeTile.transform.position, playerPos[indexPlayerPos]);
                furthermostTile = rangeTile;
            }
        }

        if (limitHealthPercent != 0)
        {
            if (getStats.character.currentHealth < (getStats.character.health / 100) * limitHealthPercent)
            {
                tempList2.Add(furthermostTile);
            }
            else
            {
                if (gridGenerator.selectedTiles.Count == 0)
                {
                    tempList2.Add(closestTile);
                }

                tempList2.AddRange(gridGenerator.selectedTiles.ToArray());
            }
        }

        RemoveDuplictas(tempList2);
        gridGenerator.DestroyTiles(DestroyOption.allList, true, false);

        for (int i = 0; i < 4; i++)
        {
            int indexTempList2 = Random.Range(0, tempList2.Count - 1);

            gridGenerator.selectedTiles.Add(tempList2[indexTempList2]);
            gridGenerator.GenerateSkillTiles(getStats.character.movementCard.ranges, getStats.character.movementCard.targetType, gameObject, TypesofValue.relative, false);
            if (allSkills.cast(getStats.character.movementCard, gridGenerator, gameObject, BattleStatus.Move, getStats))
            {
                alreadyWent = false;
                break;
            }
            CheckRotation(gameObject);
        }
    }