Ejemplo n.º 1
0
 public void Initalize(GridCell cell, SkillAbstract skill)
 {
     skill.Excute(Time.deltaTime, cell);
     Destroy(gameObject, 1f);
 }
Ejemplo n.º 2
0
 public override void Excute(float delta, GridCell targetCell)
 {
     combatUtils.PhyiscalAttack(target);
     target.GetComponent <BloodVFX>().PlayPeirceBloodEffects();
 }
Ejemplo n.º 3
0
        // mode / dir
        //0 - straight
        //1 - corner
        //2 - T
        //3 - cross
        //4 - bridge
        public int[] GetPathDirection(GridCell cell, GridCell[] neighborCells)
        {
            int totalPaths = 0; int totalRivers = 0; int lastRiverIndex = -1;

            bool[] paths        = new bool[4];
            int[]  returnValues = { 0, 0 };

            for (int i = 0; i < neighborCells.Length; i++)
            {
                if (neighborCells[i] == null)
                {
                    continue;
                }

                if (neighborCells[i].cellTemplate.isAPath || neighborCells[i].cellTemplate.stairMode != StairMode.None)
                {
                    totalPaths++;
                    paths[i] = true;
                }
                if (neighborCells[i].cellTemplate.isARiver)
                {
                    totalRivers++;
                    lastRiverIndex = i;
                }
            }
            if (totalRivers == 2)
            {
                returnValues[0] = 4;
                returnValues[1] = lastRiverIndex;
            }
            else if (totalPaths == 4)
            {
                returnValues[0] = 3;
            }
            else if (totalPaths == 3)
            {
                returnValues[0] = 2;
                for (int i = 0; i < paths.Length; i++)
                {
                    if (!paths[i])
                    {
                        returnValues[1] = i + 2 < 4 ? i + 2 : i - 2;
                        break;
                    }
                }
            }
            else if (totalPaths == 2)
            {
                for (int i = 0; i < paths.Length; i++)
                {
                    if (paths[i])
                    {
                        returnValues[1] = i;
                        returnValues[0] = 0;
                        int checkInt = i + 1 < 4 ? i + 1 : i - 3;
                        //check counterclockwise if index is zero
                        int othercheck = i == 0 ? 3 : checkInt;
                        if (paths[checkInt] || paths[othercheck])
                        {
                            returnValues[0] = 1;
                            if (!paths[checkInt])
                            {
                                returnValues[1] = checkInt + 2 < 4 ? checkInt + 2 : checkInt - 2;
                            }
                        }
                        break;
                    }
                }
            }
            else if (totalPaths == 1)
            {
                returnValues[0] = 0;
                for (int i = 0; i < paths.Length; i++)
                {
                    if (paths[i])
                    {
                        returnValues[1] = i;
                    }
                }
            }

            return(returnValues);
        }
Ejemplo n.º 4
0
 public void Initalize(GridCell cell, SkillAbstract skill)
 {
     skill.Excute(Time.deltaTime, cell);
     AlchemyManager.Instance.ApplyChill(cell);
     Destroy(gameObject, 0.75f);
 }
Ejemplo n.º 5
0
 //For external use
 public int GetCellStairDirection(GridCell cell)
 {
     GridCell[] neighborCells = GridManager.Instance.GetCellOrthogonalNeighbors(cell);
     return(GetStairDirection(cell, neighborCells));
 }
Ejemplo n.º 6
0
        public void BuildTemplatePrefabs(GridCell cell)
        {
            GridCell[] neighborCells = GridManager.Instance.GetCellOrthogonalNeighbors(cell);
            switch (decorationMode)
            {
            case DecorationMode.SinglePrefab:
                decorationSinglePrefab.BuildPrefab(cell);
                break;

            case DecorationMode.PrefabList:
                decorationPrefabList.BuildPrefab(cell);
                break;
            }

            if (isAPath)
            {
                int[] modeDir = GetPathDirection(cell, neighborCells);
                pathData.BuildPrefab(cell, modeDir[1], modeDir[0]);
                return;
            }

            if (isARiver)
            {
                int[] modeDir = GetRiverDirection(cell, neighborCells);
                riverData.BuildPrefab(cell, modeDir[1], modeDir[0] == 1 ? true : false);
                return;
            }

            switch (cellMode)
            {
            case CellMode.SinglePrefab:
                singlePrefab.BuildPrefab(cell);
                break;

            case CellMode.PrefabList:
                prefabList.BuildPrefab(cell);
                break;
            }
            if (wallMode != WallMode.None)
            {
                for (int i = 0; i < neighborCells.Length; i++)
                {
                    if (neighborCells[i] == null)
                    {
                        continue;
                    }
                    if (neighborCells[i].height <= cell.height)
                    {
                        continue;
                    }
                    for (int n = 0; n < neighborCells[i].height - cell.height; n++)
                    {
                        switch (wallMode)
                        {
                        case WallMode.SinglePrefab:
                            wallSinglePrefab.BuildPrefab(cell, i, n);
                            break;

                        case WallMode.PrefabList:
                            wallPrefabList.BuildPrefab(cell, i, n);
                            break;
                        }
                    }
                }
            }
            switch (railingMode)
            {
            case RailingMode.SinglePrefab:
                for (int i = 0; i < neighborCells.Length; i++)
                {
                    if (neighborCells[i] == null)
                    {
                        railingSinglePrefab.BuildPrefab(cell, i);
                    }
                    else if (neighborCells[i].cellTemplate.stairMode != StairMode.None)
                    {
                        continue;
                    }
                    else if (neighborCells[i].height < cell.height)
                    {
                        railingSinglePrefab.BuildPrefab(cell, i);
                    }
                }
                break;

            case RailingMode.PrefabList:
                for (int i = 0; i < neighborCells.Length; i++)
                {
                    if (neighborCells[i] == null)
                    {
                        railingPrefabList.BuildPrefab(cell, i);
                    }
                    else if (neighborCells[i].cellTemplate.stairMode != StairMode.None)
                    {
                        continue;
                    }
                    else if (neighborCells[i].height < cell.height)
                    {
                        railingPrefabList.BuildPrefab(cell, i);
                    }
                }
                break;
            }
            switch (obstacleMode)
            {
            case ObstacleMode.SinglePrefab:
                obstacleSinglePrefab.BuildPrefab(cell);
                break;

            case ObstacleMode.PrefabList:
                obstaclePrefabList.BuildPrefab(cell);
                break;
            }

            int dir;

            switch (stairMode)
            {
            case StairMode.SinglePrefab:
                dir = GetStairDirection(cell, neighborCells);
                if (dir < 0)
                {
                    break;
                }
                stairSinglePrefab.BuildPrefab(cell, neighborCells, dir);
                break;

            case StairMode.PrefabList:
                dir = GetStairDirection(cell, neighborCells);
                if (dir < 0)
                {
                    break;
                }
                stairPrefabList.BuildPrefab(cell, neighborCells, dir);
                break;
            }
        }
Ejemplo n.º 7
0
        public void SetFireInteractions(CharacterStats targetCharacterStats, object source, int burnDamage, bool fromCell = false)
        {
            if (targetCharacterStats.stateManager.statusEffects.Contains(StatusEffect.Wet))
            {
                targetCharacterStats.stateManager.statusEffects.Remove(StatusEffect.Wet);
            }
            else if (targetCharacterStats.stateManager.statusEffects.Contains(StatusEffect.Frozen))
            {
                targetCharacterStats.stateManager.statusEffects.Remove(StatusEffect.Wet);
            }

            else
            {
                if (fromCell)
                {
                    GridCell cell = (GridCell)source;
                    if (targetCharacterStats.stateManager.statusEffects.Contains(StatusEffect.Oiled) || cell.alchemyState.fireState == FireState.Inferno)
                    {
                        targetCharacterStats.stateManager.statusEffects.Add(StatusEffect.Inferno);
                        ActivateVFX.Instance.ActivateElementalEffect(StatusEffect.Inferno, targetCharacterStats.gameObject);
                        targetCharacterStats.stateManager.statusEffects.Remove(StatusEffect.Oiled);
                        StatModifier burnDamageMod = new StatModifier(burnDamage * .5f, StatModType.Flat, cell.burnSource);
                        targetCharacterStats.stateManager.burnDamageOverTime.AddModifier(burnDamageMod);
                        targetCharacterStats.stateManager.DamageSourceTurns.Add(cell.burnSource, (CombatStatType.fireDamage, 3));
                    }
                    else
                    {
                        targetCharacterStats.stateManager.statusEffects.Add(StatusEffect.Burning);
                        ActivateVFX.Instance.ActivateElementalEffect(StatusEffect.Burning, targetCharacterStats.gameObject);
                        StatModifier burnDamageMod = new StatModifier(burnDamage * .25f, StatModType.Flat, cell.burnSource);
                        targetCharacterStats.stateManager.burnDamageOverTime.AddModifier(burnDamageMod);
                        targetCharacterStats.stateManager.DamageSourceTurns.Add(cell.burnSource, (CombatStatType.fireDamage, 3));
                    }
                }
                else
                {
                    if (targetCharacterStats.stateManager.statusEffects.Contains(StatusEffect.Oiled))
                    {
                        targetCharacterStats.stateManager.statusEffects.Add(StatusEffect.Inferno);
                        ActivateVFX.Instance.ActivateElementalEffect(StatusEffect.Inferno, targetCharacterStats.gameObject);
                        targetCharacterStats.stateManager.statusEffects.Remove(StatusEffect.Oiled);
                        StatModifier burnDamageMod = new StatModifier(burnDamage * .5f, StatModType.Flat, source);
                        targetCharacterStats.stateManager.burnDamageOverTime.AddModifier(burnDamageMod);
                        targetCharacterStats.stateManager.DamageSourceTurns.Add(source, (CombatStatType.fireDamage, 3));
                    }

                    else if (Random.value >= .5f)
                    {
                        ActivateVFX.Instance.ActivateElementalEffect(StatusEffect.Burning, targetCharacterStats.gameObject);
                        targetCharacterStats.stateManager.statusEffects.Add(StatusEffect.Burning);
                        StatModifier burnDamageMod = new StatModifier(burnDamage * .25f, StatModType.Flat, source);
                        targetCharacterStats.stateManager.burnDamageOverTime.AddModifier(burnDamageMod);
                        if (targetCharacterStats.stateManager.DamageSourceTurns.ContainsKey(source))
                        {
                            targetCharacterStats.stateManager.DamageSourceTurns.Remove(source);
                        }
                        targetCharacterStats.stateManager.DamageSourceTurns.Add(source, (CombatStatType.fireDamage, 3));
                    }
                }
            }
        }
Ejemplo n.º 8
0
 public virtual void BuildPrefab(GridCell cell)
 {
     return;
 }
 public void Initalize(GridCell cell, SkillAbstract _skill)
 {
     destination = cell;
     skill       = _skill;
     LeanTween.move(gameObject, destination.transform.position + impactOffset, 1f / projectileSpeed).setOnComplete(TravelComplete).setEase(projectileTween);
 }
Ejemplo n.º 10
0
        Vector3 SinglePointNeighborCalc(GridCell cell, IntVector2 indices)
        {
            GridCell[,] neighbors = grid.GetNeighbors(cell);

            Vector3 result = Vector3.zero;

            float halfSquareSections = (float)GridMetrics.sectionsPerSquare / 2f;
            float xMult, yMult, diaMult;
            int   diaX, diaY;
            float xHeight = 0; float yHeight = 0;

            if (indices.x < halfSquareSections)
            {
                if (neighbors[0, 1] != null)
                {
                    xMult   = (halfSquareSections - indices.x) / halfSquareSections;
                    xHeight = neighbors[0, 1].height;
                    diaX    = 0;
                }
                else
                {
                    xMult = 1;
                    diaX  = -1;
                }
            }
            else
            {
                if (neighbors[2, 1] != null)
                {
                    xMult   = (indices.x - halfSquareSections) / halfSquareSections;
                    xHeight = neighbors[2, 1].height;
                    diaX    = 2;
                }
                else
                {
                    xMult = 1;
                    diaX  = -1;
                }
            }


            if (indices.y < halfSquareSections)
            {
                if (neighbors[1, 0] != null)
                {
                    yMult   = (halfSquareSections - indices.y) / halfSquareSections;
                    yHeight = neighbors[1, 0].height;
                    diaY    = 0;
                }
                else
                {
                    yMult = 1;
                    diaY  = -1;
                }
            }
            else
            {
                if (neighbors[1, 2] != null)
                {
                    yMult   = (indices.y - halfSquareSections) / halfSquareSections;
                    yHeight = neighbors[1, 2].height;
                    diaY    = 2;
                }
                else
                {
                    yMult = 1;
                    diaY  = -1;
                }
            }

            result.y += ((xMult * (xHeight - cell.height)) / 2f) * (1 - yMult);
            result.y += ((yMult * (yHeight - cell.height)) / 2f) * (1 - xMult);
            diaMult   = Mathf.Sqrt(xMult * xMult + yMult * yMult) / 1.414f;
            float diaHeight = diaY != -1 && diaX != -1 ? neighbors[diaX, diaY].height : cell.height;

            diaHeight = (diaHeight + yHeight + xHeight) / 3f;
            result.y += (xMult) * (yMult) * (diaHeight - cell.height) * diaMult;

            if (diaX >= 0 && diaY >= 0)
            {
                //  result.y += ((neighbors[diaX, diaY].height - cell.height) * diaMult);
            }
            else
            {
                diaMult = 1;
            }

            // result.y *= 1 - xMult; result.y *= 1 - yMult; result.y *= 1 - diaMult;

            //result.y += diaMult * Mathf.Sqrt((yHeight - cell.height) * (yHeight - cell.height) + (xHeight - cell.height) * (xHeight - cell.height));

            return(result);
        }
Ejemplo n.º 11
0
 public GridCell[] GetCellOrthogonalNeighbors(GridCell cell)
 {
     return(mapAdapter.GetOrthogonalNeighbors(cell));
 }
Ejemplo n.º 12
0
 public GridCell[,] GetCellNeighbors(GridCell cell)
 {
     return(mapAdapter.GetNeighbors(cell));
 }
Ejemplo n.º 13
0
 public void Initalize(GridCell cell, SkillAbstract skill)
 {
     destination = cell;
     skill.Excute(Time.deltaTime, cell);
     Destroy(gameObject, lifeTime);
 }