Пример #1
0
        public override void Cast(float delta, IntVector2 targetIndex)
        {
            List <GridCell> cells = CastableShapes.GetCastableCells(skill, targetIndex);

            characterStats.transform.LookAt(cells[0].transform);
            animationHandler.PlayTargetAnimation("SpellCastHand");
            characterStats.UseAP(skill.APcost);

            GridManager.Instance.RemoveAllHighlights();
            GameObject effect = Instantiate(skill.effectPrefab,
                                            taticalMovement.transform.position + Vector3.up * 1.5f + taticalMovement.transform.forward * 1f,
                                            Quaternion.identity);

            effect.GetComponent <VFXSpawns>().Initialize(cells, this, taticalMovement.currentIndex);
        }
Пример #2
0
        public override void Cast(float delta, IntVector2 targetIndex)
        {
            List <GridCell> cells = CastableShapes.GetCastableCells(skill, targetIndex);

            targetCell = cells[0];

            target = targetCell.GetOccupyingObject();

            if (target != null)
            {
                characterStats.transform.LookAt(target.transform);
                characterStats.UseAP(skill.APcost);
                animationHandler.PlayTargetAnimation("Attack");
            }
        }
Пример #3
0
        public override void Cast(float delta, IntVector2 targetIndex)
        {
            List <GridCell> cells      = CastableShapes.GetCastableCells(skill, targetIndex);
            GridCell        targetCell = cells[0];

            target = targetCell.GetOccupyingObject();

            if (target != null)
            {
                characterStats.transform.LookAt(target.transform);
                characterStats.transform.Rotate(Quaternion.Euler(0f, 60f, 0f).eulerAngles);
                animationHandler.PlayTargetAnimation("Attack");
                arrowHolder.targetCell = targetCell;
                arrowHolder.target     = target;
                characterStats.UseAP(skill.APcost);
            }
        }
Пример #4
0
        public void HighlightCastableRange(IntVector2 playerOrigin, IntVector2 castOrigin, Skill skill)
        {
            List <GridCell> rangeCells = new List <GridCell>();
            List <GridCell> castRange  = new List <GridCell>();
            List <GridCell> outerRange = new List <GridCell>();

            switch (skill.castType)
            {
            case CastType.Free:
                rangeCells = CastableShapes.GetRangeCells(skill, playerOrigin);
                castRange  = CastableShapes.GetCastableCells(skill, castOrigin);
                outerRange = CastableShapes.CircularCells(playerOrigin, skill.castableSettings.radius + skill.castableSettings.range, skill.castableSettings.range + 1);
                break;

            case CastType.Pinned:
                rangeCells = new List <GridCell>();
                castRange  = PinnedShapes.GetPinnedCells(skill, playerOrigin, castOrigin);
                outerRange = PinnedShapes.CircularCells(skill, playerOrigin);
                break;
            }
            foreach (GridCell cell in outerRange)
            {
                if (!castRange.Contains(cell))
                {
                    cell.RemoveHighlight();
                }
            }

            foreach (GridCell cell in rangeCells)
            {
                cell.ApplyHighlight(castableValidPrefab, CellHighlightType.InRange);
                allHighlightedTiles.Add(cell.index);
            }
            if (castOrigin.GetDistance(playerOrigin) <= skill.castableSettings.range)
            {
                foreach (GridCell cell in castRange)
                {
                    cell.ApplyHighlight(castableHighlightPrefab, CellHighlightType.Castable);
                    allHighlightedTiles.Add(cell.index);
                }
            }
        }
Пример #5
0
        public static void Activate(CharacterStats characterStats, AnimationHandler animationHandler, TaticalMovement taticalMovement, Skill skill, float delta)
        {
            IntVector2 index = taticalMovement.GetMouseIndex();

            GridManager.Instance.HighlightCastableRange(taticalMovement.currentIndex, index, skill);
            int distance = taticalMovement.GetRequiredMoves(index, taticalMovement.path);

            if (index.x >= 0 && characterStats.currentAP >= skill.APcost)
            {
                if (Input.GetMouseButtonDown(0) || InputHandler.instance.tacticsXInput)
                {
                    InputHandler.instance.tacticsXInput = false;

                    animationHandler.PlayTargetAnimation("Attack");
                    characterStats.UseAP(skill.APcost);
                    GridManager.Instance.RemoveAllHighlights();
                    List <GridCell> cells = CastableShapes.GetCastableCells(skill, index);
                    foreach (GridCell cell in cells)
                    {
                        AlchemyManager.Instance.ApplyLiquid(cell.alchemyState, LiquidPhaseState.Oil);
                    }
                }
            }
        }