Example #1
0
    void Awake()
    {
        _caster       = GetComponent <AbilityCaster>();
        _eventHandler = GetComponent <EventHandler>();
        _targeting    = GetComponent <CharacterTargeting>();
        _floatingText = GetComponent <CharacterFloatingText>();
        _meleeVector  = GetComponent <CharacterMeleeVector>();

        AttackPower = _template.AttackPower;
        Armor       = _template.Armor;
        Health      = _template.Health;
        Dead        = false;
    }
Example #2
0
 void Start()
 {
     ct = GetComponentInParent <CharacterTargeting>();
 }
 // Start is called before the first frame update
 void Start()
 {
     charTar    = GetComponent <CharacterTargeting>();
     bulletList = new List <IMutatable>();
     charCon    = GetComponent <SharedCharacterController>();
 }
Example #4
0
 void Start()
 {
     ct = GetComponentInParent <CharacterTargeting>();
     Destroy(this.gameObject, shieldDuration);
 }
Example #5
0
 // Start is called before the first frame update
 void Start()
 {
     charTar = GetComponent <CharacterTargeting>();
     charCon = GetComponent <SharedCharacterController>();
 }
Example #6
0
        private static void possiblePositionsFromStep(Level level, List <IntVec> positions, int[,] used, IntVec start, IntVec position, int budget, CharacterTargeting targetCharacters, bool straight, bool expand)
        {
            if ((!straight || lineIsFree(level, start, position, targetCharacters != CharacterTargeting.PASS_THROUGH)))
            {
                used[position.X, position.Y] = budget;

                if (!start.Equals(position) && !positions.Contains(position))
                {
                    positions.Add(position);
                }

                if (expand && budget > 0)
                {
                    foreach (Direction dir in Direction.Values)
                    {
                        IntVec target = position + dir;
                        if (used[target.X, target.Y] < budget - 1 || (used[target.X, target.Y] == int.MaxValue && (targetCharacters == CharacterTargeting.PASS_THROUGH || targetCharacters == CharacterTargeting.TARGET_FIRST) && level.CharacterEntities.FindEntity(target) != null))
                        {
                            possiblePositionsFromStep(level, positions, used, start, target, budget - 1, targetCharacters, straight, !(used[target.X, target.Y] == int.MaxValue));
                        }
                    }
                }
            }
        }
Example #7
0
        /// <summary>
        /// Returns an array of positions that are able to be reached from a certain position given a move budget
        /// </summary>
        /// <param name="level">Level layout to query</param>
        /// <param name="start">Starting position</param>
        /// <param name="budget">How many movements it can make (-1 is infinite)</param>
        /// <param name="straight">Whether the positions should be in direct view</param>
        /// <returns>An unordered array of positions</returns>
        public static IntVec[] getPossiblePositionsFrom(Level level, IntVec start, int budget = -1, CharacterTargeting targetCharacters = CharacterTargeting.TREAT_AS_SOLID, bool straight = false)
        {
            List <IntVec> positions = new List <IntVec>();

            int[,] used = level.getIntSolid(targetCharacters != CharacterTargeting.PASS_THROUGH);
            //used[start.X, start.Y] = int.MaxValue - 1;

            possiblePositionsFromStep(level, positions, used, start, start, budget, targetCharacters, straight, true);

            return(positions.ToArray <IntVec>());
        }
Example #8
0
        public static IntVec[] getPossiblePositionsInBox(Level level, IntVec start, int width = 1, int height = 1, CharacterTargeting targetCharacters = CharacterTargeting.TREAT_AS_SOLID, bool straight = false)
        {
            IntVec[] results = getPossiblePositionsFrom(level, start, width + height, targetCharacters, straight);

            List <IntVec> actualResults = new List <IntVec>();

            foreach (IntVec vec in results)
            {
                if (Math.Abs(vec.X - start.X) <= width && Math.Abs(vec.Y - start.Y) <= height)
                {
                    actualResults.Add(vec);
                }
            }

            return(actualResults.ToArray());
        }