JobHandle ProcessViewEntities(bool mapRegenerated, DynamicBuffer <MapTiles> map, MapData mapData, JobHandle inputDeps)
        {
            // Process Entities with only a view and no memory
            return(Entities
                   .WithReadOnly(map)
                   .WithChangeFilter <Position>()
                   .WithNone <TilesInMemory>()
                   .ForEach((ref DynamicBuffer <TilesInView> view, in Position pos, in ViewRange range) =>
            {
                if (view.Length != map.Length || mapRegenerated)
                {
                    view.ResizeUninitialized(map.Length);
                }

                // Always reset view before rebuilding
                for (int i = 0; i < view.Length; ++i)
                {
                    view[i] = false;
                }

                var visibility = new VisibilityMap(
                    mapData.width,
                    mapData.height,
                    map.Reinterpret <TileType>().AsNativeArray(),
                    view.Reinterpret <bool>().AsNativeArray()
                    );

                FOV.Compute(pos, range, visibility);
            }).Schedule(inputDeps));
Ejemplo n.º 2
0
        private void SetLightSource(EmberCell cell)
        {
            if (cell.LightProperties.EmitsLight)
            {
                var fov = new FOV(GridManager.Grid.FieldOfView);
                fov.Calculate(cell.Position, cell.LightProperties.LightRadius);
                var toChangeCells = new List <(EmberCell, float)>();
                for (int x = 0; x < GridManager.Grid.GridSizeX; x++)
                {
                    for (int y = 0; y < GridManager.Grid.GridSizeY; y++)
                    {
                        // If cell is in the field of view of the object
                        if (fov.BooleanFOV[x, y])
                        {
                            var pos = new Point(x, y);
                            var distanceOfCenter = cell.Position.SquaredDistance(pos);
                            var cellToAdd        = GridManager.Grid.GetCell(x, y);
                            if (!cellToAdd.LightProperties.EmitsLight)
                            {
                                if (cellToAdd.LightProperties.LightSources == null)
                                {
                                    cellToAdd.LightProperties.LightSources = new List <EmberCell>();
                                }
                                cellToAdd.LightProperties.LightSources.RemoveAll(a => a.Position == cell.Position);
                                cellToAdd.LightProperties.LightSources.Add(cell);
                            }
                            toChangeCells.Add((cellToAdd, distanceOfCenter));
                        }
                    }
                }

                HandleBrightnessLayers(toChangeCells, cell);
            }
        }
Ejemplo n.º 3
0
 private void Awake()
 {
     m_TurnManager  = TurnManager.Instance;
     m_TileManager  = TileManager.Instance;
     m_EnemyManager = EnemyManager.Instance;
     fov            = new FOV();
 }
Ejemplo n.º 4
0
 void Start()
 {
     rb       = GetComponent <Rigidbody2D>();
     player   = FindObjectOfType <Player>();
     aiaudio  = GetComponent <AudioSource>();
     enemyFOV = GetComponentInChildren <FOV>();
 }
Ejemplo n.º 5
0
    private void OnSceneGUI()
    {
        FOV fov = (FOV)target;

        Handles.color = Color.white;
        Handles.DrawWireArc(fov.transform.position, Vector3.forward, Vector2.right, 360, fov.viewRadius);
        Vector3 viewAngleA = fov.DirFromAngle(-fov.viewAngle / 2, false);
        Vector3 viewAngleB = fov.DirFromAngle(fov.viewAngle / 2, false);

        Handles.DrawLine(fov.transform.position, fov.transform.position + viewAngleA * fov.viewRadius);
        Handles.DrawLine(fov.transform.position, fov.transform.position + viewAngleB * fov.viewRadius);

        if (fov.hasSubFOV)
        {
            Handles.color = Color.yellow;
            Handles.DrawWireArc(fov.transform.position, Vector3.forward, Vector2.right, 360, fov.subViewRadius);
            Vector3 subViewAngleA = fov.DirFromAngle(-fov.subViewAngle / 2, false);
            Vector3 subViewAngleB = fov.DirFromAngle(fov.subViewAngle / 2, false);
            Handles.DrawLine(fov.transform.position, fov.transform.position + subViewAngleA * fov.subViewRadius);
            Handles.DrawLine(fov.transform.position, fov.transform.position + subViewAngleB * fov.subViewRadius);
        }

        Handles.color = Color.red;
        foreach (Transform visibleTarget in fov.visibleTargets)
        {
            Handles.DrawLine(fov.transform.position, visibleTarget.position);
        }
    }
Ejemplo n.º 6
0
        static void TestFOV()
        {
            using (FOV f = new FOV(new Size(10, 10)))
            {
                // . # .
                // # . .
                // . . .
                f.SetCell(new Point(0, 0), true, true);
                f.SetCell(new Point(1, 0), false, false);
                f.SetCell(new Point(2, 0), true, true);
                f.SetCell(new Point(0, 1), false, false);
                f.SetCell(new Point(1, 1), true, true);
                f.SetCell(new Point(2, 1), true, true);
                f.SetCell(new Point(0, 2), true, true);
                f.SetCell(new Point(1, 2), true, true);
                f.SetCell(new Point(2, 2), true, true);

                Console.WriteLine(f.GetCellTransparent(new Point(2, 2)));
                Console.WriteLine(f.GetCellWalkable(new Point(2, 2)));

                f.Calculate(new Point(0, 0), 5, true, FovAlgorithm.Shadow);
                Console.WriteLine(f.IsInView(new Point(2, 0)));
                Console.WriteLine(f.IsInView(new Point(0, 2)));
                Console.WriteLine(f.IsInView(new Point(2, 2)));
            }
        }
Ejemplo n.º 7
0
        private void SearchForTarget(Actor actor)
        {
            FOV fov = new FOV(actor.Parent.CurrentMap.TransparencyView);

            fov.Calculate(actor.Parent.Position);

            foreach (Coord pos in fov.CurrentFOV)
            {
                if (!(actor.Parent.CurrentMap.GetObject(pos).GetComponent <Actor>() is Actor otherActor))
                {
                    continue;
                }

                if (actor.Being.Alignment.GetRelation(otherActor.Being.Alignment) != AlignmentRelation.Enemy)
                {
                    continue;
                }

                _target         = otherActor;
                _targetLastSeen = otherActor.Parent.Position;

                return;
            }

            _target = null;
        }
Ejemplo n.º 8
0
        public override Queue <Location> ExtractPlan(Subject s, Intention i, Beliefs b, List <Location> path)
        {
            Queue <Location> plan = new Queue <Location>();
            Location         dest = new Location();

            HashSet <Location> fov = FOV.GetFov(b.Agents[i.ID].Direction, b.Agents[i.ID].Location);

            if (fov.Except(FOV.GetSharedFov(s, b.Agents[i.ID])).Count() > 0)
            {
                dest = Util.RandomElement(fov.Except(FOV.GetSharedFov(s, b.Agents[i.ID])).ToList(), s.Location);
            }
            else
            {
                dest = Util.RandomElement(fov.ToList(), s.Location);
            }

            FlankNode fNode = new FlankNode(null, dest, b.Agents[i.ID].Location)
            {
                CurLocation = new Location(s.Location),
                Obstacles   = new HashSet <Location>(b.Obstacles.Keys)
            };

            fNode.Obstacles.UnionWith(Util.GetDynamicObstacles(s.ID, s.Location, b));

            plan = Planner.Search(fNode);

            return(plan);
        }
Ejemplo n.º 9
0
        public static string Vault(string[] args, GameController ctrl)
        {
            float rotation = 0f;

            if (args.Length == 2)
            {
                float.TryParse(args[1], out rotation);
            }

            if (!Assets.Vaults.ContainsKey(args[0]))
            {
                return($"Vault {args[0]} does not exist.");
            }

            string ret;

            if (!Gen.Vault.TryBuild(args[0], ctrl.World.ActiveLevel,
                                    ctrl.Cursor.HoveredCell.Position, rotation))
            {
                ret = $"Failed to build vault {args[0]} at {ctrl.Cursor.HoveredCell.Position}.";
            }
            else
            {
                ret = $"Successfully built vault {args[0]} at {ctrl.Cursor.HoveredCell.Position}.";
            }

            FOV.RefreshFOV(ctrl.World.ActiveLevel, ctrl.PC.Cell, true);
            return(ret);
        }
Ejemplo n.º 10
0
 void Start()
 {
     fov      = Instantiate(pffov, null).GetComponent <FOV>();
     rb       = GetComponent <Rigidbody2D>();
     Velocity = rb.velocity;
     i        = 0;
 }
Ejemplo n.º 11
0
        public void FOVCurrentHash()
        {
            var map = new BoxResMap(50, 50);
            var fov = new FOV(map);

            fov.Calculate(20, 20, 10);

            // Inefficient copy but fine for testing
            HashSet <Coord> currentFov = new HashSet <Coord>(fov.CurrentFOV);

            for (int x = 0; x < map.Width; x++)
            {
                for (int y = 0; y < map.Height; y++)
                {
                    if (fov[x, y] > 0.0)
                    {
                        Assert.AreEqual(true, currentFov.Contains(Coord.Get(x, y)));
                    }
                    else
                    {
                        Assert.AreEqual(false, currentFov.Contains(Coord.Get(x, y)));
                    }
                }
            }
        }
Ejemplo n.º 12
0
        public void RemoveMultipleEmittingCells_AdjacentCells_UpdatedCorrectly()
        {
            var positions = new[] { new Point(10, 10), new Point(13, 10), new Point(11, 13) };
            var radiuses  = new int[] { 4, 6, 4 };

            for (int i = 0; i < positions.Length; i++)
            {
                SetLightCell(positions[i].X, positions[i].Y, radiuses[i]);
                UnsetLightCell(positions[i].X, positions[i].Y);
            }

            for (int i = 0; i < positions.Length; i++)
            {
                var fov = new FOV(_grid.FieldOfView);
                fov.Calculate(positions[i], radiuses[i]);

                for (int x = 0; x < _grid.GridSizeX; x++)
                {
                    for (int y = 0; y < _grid.GridSizeY; y++)
                    {
                        if (fov.BooleanFOV[x, y])
                        {
                            Assert.IsTrue(_grid.GetCell(x, y).LightProperties.Brightness == 0f);
                        }
                    }
                }
            }
        }
Ejemplo n.º 13
0
    // The recursive higher-order observation method as described in the thesis.
    // It has a height limiter to specify the desired max order of observation.
    public void UpdateToM(Subject s, Beliefs b, HashSet <Location> fov, int height)
    {
        if (height == 0 || b.Sees.Agents.Count == 0)
        {
            return;
        }

        foreach (KeyValuePair <char, Subject> kvp in b.Sees.Agents)
        {
            HashSet <Location> intersectFov = FOV.GetSharedFov(kvp.Value, s);

            VisionPercept vp = Sight.Perceive(kvp.Key, intersectFov);
            AudioPercept  ap = Hearing.Perceive(kvp.Key, kvp.Value.Location);

            if (!b.ToM.ContainsKey(kvp.Key))
            {
                b.ToM.Add(kvp.Key, new Beliefs());
            }

            b.ToM[kvp.Key].Update(vp);
            b.ToM[kvp.Key].Update(ap);

            UpdateToM(kvp.Value, b.ToM[kvp.Key], intersectFov, height - 1);
        }
    }
Ejemplo n.º 14
0
        public void FOVTest()
        {
            var testMap = new ArrayMap <bool>(5, 5);

            foreach (Coord coord in testMap.Positions())
            {
                testMap[coord] = true;
            }

            var centre = new Coord(2, 2);

            foreach (Coord coord in new RadiusAreaProvider(centre, 2, Radius.CIRCLE).CalculatePositions())
            {
                testMap[coord] = false;
            }
            foreach (Coord coord in new RadiusAreaProvider(centre, 1, Distance.EUCLIDEAN).CalculatePositions())
            {
                testMap[coord] = true;
            }

            var resMap = new ArrayMap <bool>(5, 5);

            foreach (Coord coord in testMap.Positions())
            {
                resMap[coord] = testMap[coord];
            }

            var FOV = new FOV(resMap);

            FOV.Calculate(centre, 1, Distance.EUCLIDEAN);

            Coord[] calculated = FOV.CurrentFOV.OrderBy(p => p.X).ThenBy(p => p.Y).ToArray();
            Assert.True(calculated.SequenceEqual(new[]
                                                 { new Coord(1, 2), new Coord(2, 1), new Coord(2, 2), new Coord(2, 3), new Coord(3, 2) }));
        }
Ejemplo n.º 15
0
        protected override void WriteDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            ele.TryPathTo("Time", true, out subEle);
            subEle.Value = Time.ToString();

            ele.TryPathTo("Radius", true, out subEle);
            subEle.Value = Radius.ToString();

            ele.TryPathTo("Color", true, out subEle);
            Color.WriteXML(subEle, master);

            ele.TryPathTo("Flags", true, out subEle);
            subEle.Value = Flags.ToString();

            ele.TryPathTo("FalloffExponent", true, out subEle);
            subEle.Value = FalloffExponent.ToString("G15");

            ele.TryPathTo("FOV", true, out subEle);
            subEle.Value = FOV.ToString("G15");

            ele.TryPathTo("Value", true, out subEle);
            subEle.Value = Value.ToString();

            ele.TryPathTo("Weight", true, out subEle);
            subEle.Value = Weight.ToString("G15");
        }
        public void InitializeFOV(Dungeon dungeon, int level)
        {
            int mapWidth  = dungeon.dungeon[level].Width;
            int mapHeight = dungeon.dungeon[level].Height;

            fovMap = new ArrayMap <bool>(mapWidth, mapHeight);
            ArrayMap <Tile> map = dungeon.dungeon[level].GetLevel();

            for (int x = 0; x < mapWidth; x++)
            {
                for (int y = 0; y < mapHeight; y++)
                {
                    if (map[x, y].IsSolid() == true)
                    {
                        fovMap[x, y] = false; //set to false if it does block FOV
                    }
                    else
                    {
                        fovMap[x, y] = true;
                    }
                }
            }

            fov = new FOV(fovMap);
            fov.Calculate(new Point(Position.X, Position.Y), 12);
        }
Ejemplo n.º 17
0
        public void RemoveMultipleEmittingCells_AdjacentCells_UpdatedCorrectly()
        {
            var cells = new[] { SetLightCell(10, 10, 4), SetLightCell(13, 10, 6), SetLightCell(11, 13, 4) };

            cells = new[] { UnsetLightCell(10, 10), UnsetLightCell(13, 10), UnsetLightCell(11, 13) };
            var radiuses = new int[] { 4, 6, 4 };

            for (int i = 0; i < cells.Length; i++)
            {
                var area = new List <EmberCell>();
                GetRadiusNeighbors(cells[i], radiuses[i], area);
                var points = area.ToDictionary(a => a.Position, a => a);

                var fov = new FOV(_grid.FieldOfView);
                fov.Calculate(cells[i].Position, radiuses[i]);

                for (int x = 0; x < _grid.GridSizeX; x++)
                {
                    for (int y = 0; y < _grid.GridSizeY; y++)
                    {
                        if (fov.BooleanFOV[x, y])
                        {
                            Assert.IsTrue(points.TryGetValue(new Point(x, y), out EmberCell value));
                            Assert.IsTrue(value.LightProperties.Brightness == 0f);
                        }
                    }
                }
            }
        }
Ejemplo n.º 18
0
        public void FOVCurrentHash()
        {
            var map    = BoxResMap(50, 50);
            var fovMap = new LambdaTranslationMap <double, bool>(map, d => d >= 1.0 ? false : true);
            var fov    = new FOV(fovMap);

            fov.Calculate(20, 20, 10);

            // Inefficient copy but fine for testing
            HashSet <Coord> currentFov = new HashSet <Coord>(fov.CurrentFOV);

            for (int x = 0; x < map.Width; x++)
            {
                for (int y = 0; y < map.Height; y++)
                {
                    if (fov[x, y] > 0.0)
                    {
                        Assert.AreEqual(true, currentFov.Contains((x, y)));
                    }
                    else
                    {
                        Assert.AreEqual(false, currentFov.Contains((x, y)));
                    }
                }
            }
        }
Ejemplo n.º 19
0
    public override void OnInspectorGUI()
    {
        //base.OnInspectorGUI();
        FOV fov = (FOV)target;

        fov.viewRadius = EditorGUILayout.FloatField("View Radius", fov.viewRadius);
        fov.viewAngle  = EditorGUILayout.Slider("View Angle", fov.viewAngle, 0f, 360f);
        fov.viewRes    = EditorGUILayout.FloatField("View Resolution", fov.viewRes);

        fov.hasSubFOV     = EditorGUILayout.BeginToggleGroup("Has Sub FOV", fov.hasSubFOV);
        fov.subViewRadius = EditorGUILayout.FloatField("SubView Radius", fov.subViewRadius);
        fov.subViewAngle  = EditorGUILayout.Slider("SubView Angle", fov.subViewAngle, 0f, fov.viewAngle);
        fov.subViewRes    = EditorGUILayout.FloatField("SubView Resolution", fov.subViewRes);
        EditorGUILayout.EndToggleGroup();

        //fov.obstacleMask = EditorGUILayout.MaskField("Obstacle Mask", fov.obstacleMask);
        LayerMask tempMask = EditorGUILayout.MaskField("Obstacle Mask", InternalEditorUtility.LayerMaskToConcatenatedLayersMask(fov.obstacleMask), InternalEditorUtility.layers);

        fov.obstacleMask = InternalEditorUtility.ConcatenatedLayersMaskToLayerMask(tempMask);

        fov.edgeResolveIterations = EditorGUILayout.IntField("Edge Resolve Iterations", fov.edgeResolveIterations);
        fov.edgeDstThreshold      = EditorGUILayout.FloatField("Edge Dst Threshold", fov.edgeDstThreshold);

        fov.debug = EditorGUILayout.Toggle("Debug", fov.debug);

        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);
        }
    }
Ejemplo n.º 20
0
        public EntityBase(Color foreground, Color background, int glyph, Map map, bool haveVision = false, int visionRange = 20) : base(1, 1)
        {
            Animation.CurrentFrame[0].Foreground = foreground;
            Animation.CurrentFrame[0].Background = background;
            Animation.CurrentFrame[0].Glyph      = glyph;

            EntityStatus = new EntityStatus();

            Inventory = new Inventory(EntityStatus.MaxWeight);

            this.map = map;

            HaveVision = haveVision;
            if (HaveVision)
            {
                fovmap      = new FOV(map);
                VisionRange = visionRange;
            }

            Equip = new ItemBase("Pickaxe", 10f);
            Equip.ItemBehaviour = ItemBehaviourHelper.Mine();

            random = RandomNumberServiceLocator.GetService();
            logger = LoggingServiceLocator.GetService();

            ID = random.NextUint();
        }
Ejemplo n.º 21
0
        public void SetEmittingCell_AdjacentCells_UpdatedCorrectly()
        {
            var cell = SetLightCell(10, 10, 4);

            var area = new List <EmberCell>();

            GetRadiusNeighbors(cell, cell.LightProperties.LightRadius, area);
            var points = area.ToDictionary(a => a.Position, a => a);

            var fov = new FOV(_grid.FieldOfView);

            fov.Calculate(cell.Position, cell.LightProperties.LightRadius);

            for (int x = 0; x < _grid.GridSizeX; x++)
            {
                for (int y = 0; y < _grid.GridSizeY; y++)
                {
                    if (fov.BooleanFOV[x, y])
                    {
                        Assert.IsTrue(points.TryGetValue(new Point(x, y), out EmberCell value));
                        Assert.IsTrue(value.LightProperties.Brightness > 0f);
                    }
                }
            }
        }
Ejemplo n.º 22
0
        public static string Relic(string[] args, GameController ctrl)
        {
            Entity relic = Gen.Relic.MakeRelic();

            relic.Move(ctrl.World.ActiveLevel, ctrl.Cursor.HoveredCell);
            FOV.RefreshFOV(ctrl.World.ActiveLevel, ctrl.PC.Cell, true);
            return($"Spawned {relic} at {ctrl.Cursor.HoveredCell}.");
        }
Ejemplo n.º 23
0
 //gets scripts
 void Start()
 {
     data    = GetComponent <TankData>();
     motor   = GetComponent <TankMotor>();
     tf      = GetComponent <Transform>();
     shoot   = GetComponent <Shoot>();
     fov     = GetComponent <FOV>();
     hearing = GetComponent <Hearing>();
 }
Ejemplo n.º 24
0
        public void RemoveOneEmittingCell_FromManyEmittingCells_AdjacentCells_UpdatedCorrectly()
        {
            var setCells   = new[] { SetLightCell(10, 10, 4), SetLightCell(13, 10, 6), SetLightCell(11, 13, 4) };
            var unsetCells = new[] { UnsetLightCell(13, 10) };

            foreach (var cell in setCells.Except(unsetCells))
            {
                var area = new List <EmberCell>();
                GetRadiusNeighbors(cell, cell.LightProperties.LightRadius, area);
                var points = area.ToDictionary(a => a.Position, a => a);

                var fov = new FOV(_grid.FieldOfView);
                fov.Calculate(cell.Position, cell.LightProperties.LightRadius);

                for (int x = 0; x < _grid.GridSizeX; x++)
                {
                    for (int y = 0; y < _grid.GridSizeY; y++)
                    {
                        if (fov.BooleanFOV[x, y])
                        {
                            Assert.IsTrue(points.TryGetValue(new Point(x, y), out EmberCell value));
                            Assert.IsTrue(value.LightProperties.Brightness > 0f);
                        }
                    }
                }
            }

            // Check unset cell for light sources = null has 0 brightness
            var area2 = new List <EmberCell>();

            GetRadiusNeighbors(unsetCells[0], unsetCells[0].LightProperties.LightRadius, area2);
            var points2 = area2.ToDictionary(a => a.Position, a => a);

            var fov2 = new FOV(_grid.FieldOfView);

            fov2.Calculate(unsetCells[0].Position, unsetCells[0].LightProperties.LightRadius);

            bool someCellsAreUnset = false;

            for (int x = 0; x < _grid.GridSizeX; x++)
            {
                for (int y = 0; y < _grid.GridSizeY; y++)
                {
                    if (fov2.BooleanFOV[x, y])
                    {
                        Assert.IsTrue(points2.TryGetValue(new Point(x, y), out EmberCell value));
                        if (value.LightProperties.LightSources == null && !value.LightProperties.EmitsLight)
                        {
                            someCellsAreUnset = true;
                            Assert.IsTrue(value.LightProperties.Brightness == 0f);
                        }
                    }
                }
            }
            Assert.IsTrue(someCellsAreUnset);
        }
Ejemplo n.º 25
0
 public void Init(Coord pos, Map map)
 {
     _go = new GoRogue.GameFramework.GameObject(pos, 1, this, isWalkable: _isWalkable, isTransparent: _isTransparent);
     gameObject.transform.position = new Vector3(pos.X, pos.Y, 0);
     map.AddEntity(this);
     Pathing = new AStar(map.WalkabilityView, Distance.CHEBYSHEV);
     Fov     = new FOV(map.WalkabilityView);
     Moved  += OnMoved;
     DungeonMap.FOVWasUpdated += OnFovUpdated;
 }
Ejemplo n.º 26
0
    private void Awake()
    {
        navMeshAgent = GetComponent <NavMeshAgent>();
        fov          = GetComponent <FOV>();

        if (GetComponent <Rigidbody>() != null)
        {
            myrb = GetComponent <Rigidbody>();
        }
    }
Ejemplo n.º 27
0
        public void TestAccessBeforeCalculate()
        {
            var testFOVMap = EmptyFOVMap(17, 17);
            var myFOV      = new FOV(testFOVMap);

            foreach (var pos in testFOVMap.Positions())
            {
                Assert.AreEqual(0.0, myFOV[pos]);
            }
        }
Ejemplo n.º 28
0
 public override void OnMapChanged(Map newMap)
 {
     base.OnMapChanged(newMap);
     if (newMap == null)
     {
         return;                 // was removed from map
     }
     Behaviour = new MoveAndAttackBehaviour(this, newMap as GameMap);
     FOV       = new FOV(newMap.WalkabilityView);
 }
Ejemplo n.º 29
0
        // Use this for initialization
        public void Awake()
        {
            // Setting up references.
            ChangeState(new IdleState());

            m_Character = GetComponent <PlatformerCharacter2D>();

            seeker      = GetComponent <Seeker>();
            fieldOfView = GetComponent <FOV>();
            if (Target != null)
            {
                seeker.StartPath(m_Character.m_GroundCheck.transform.position, Target.transform.position, OnPathComplete);
            }

            // Starts path finding script
            StartCoroutine(UpdatePath());

            // Set the health of the AI based on what kind of AI it is.
            if (knight)
            {
                m_Character.health         = 2;
                m_Character.ability1Learnt = true;
            }
            else if (juggernaut)
            {
                m_Character.health         = 3;
                m_Character.ability3Learnt = true;
            }
            else if (ninja)
            {
                m_Character.health         = 1;
                m_Character.ability2Learnt = true;
            }
            else
            {
                m_Character.health = 1;
            }

            // Determine the AI's attack range based on kind of AI.
            // These values will probably need to change or be altered based on scale...
            if (ninja || juggernaut)
            {
                attackRange           = 3.0f * transform.localScale.x;
                m_Character.specialAI = true;
            }
            else if (knight)
            {
                attackRange           = 3.0f * (transform.localScale.x * 2);
                m_Character.specialAI = true;
            }
            else
            {
                attackRange = 10.0f * transform.localScale.x;
            }
        }
Ejemplo n.º 30
0
    // Start is called before the first frame update
    void Start()
    {
        standardShot = new AttackTurretOld();
        standardShot.SetUp(TurretBaseOld.TurretType.ATTACK);

        standardShot.Experience    = 0f;
        standardShot.firePoint     = firePoint;
        standardShot.startPosition = transform;
        _fov = GetComponentInChildren <FOV>();
        standardShot.fireRate = 4f;
    }
Ejemplo n.º 31
0
    void Awake()
    {
        _transform = transform;

        _meshParent = GameObject.Find("Meshes");
        _editPointsParent = GameObject.Find("EditPoints");

        _editPoints = new List<Vector3>();
        _meshList = new MeshList(_meshParent, meshPrefab);
        _fov = new FOV(_transform);
        _eventSystem = GameObject.Find("EventSystem").GetComponent<EventSystem>();
    }