// Handles casting a spell at a desired location
 public void ConfirmLocation()
 {
     // Ensures that the selected area is in the cast range
     if (Input.GetMouseButtonDown(0) && RangeArea.Contains(TileController.GridLayout.WorldToCell(InputController.CursorPosition)))
     {
         // Ensures the user was not trying to click a UI element
         if (!EventSystem.current.IsPointerOverGameObject())
         {
             // Sets the ability animation colors
             if (AbilityController.Type == AbilityController.AbilityType.Damage)
             {
                 SetColors(_damageColor1, _damageColor2, _damageColor3);
             }
             else
             {
                 // This is where additional ability colors will go later TODO
                 SetColors(_damageColor1, _damageColor2, _damageColor3);
             }
             // Removes the tiles colored for displaying range
             TileController.Instance.ClearTiles(RangeArea);
             // Begins cast animation
             StartCoroutine(AbilityController.Instance.Animation(_damageColor1, _damageColor2, _damageColor3));
             // Clear the reticle type
             AbilityController.Reticle = AbilityController.ReticleType.None;
         }
     }
 }
Пример #2
0
    public int[] GetPosInArea(Areas _area)
    {
        RangeArea area = specificAreas.Find(sa => sa.areaType == _area);

        return(new int[2] {
            Random.Range(area.startFear, area.endFear + 1), Random.Range(area.startRespect, area.endRespect + 1)
        });
    }
Пример #3
0
        public override void _Ready()
        {
            this.AddChild(this.LineDrawer);
            RangeArea.Connect("body_entered", this, nameof(On_Area_Entered));
            RangeArea.Connect("body_exited", this, nameof(On_Area_Exited));

            this.AddChild(AttackTimer);
            AttackTimer.OneShot = false;
            AttackTimer.Connect("timeout", this, nameof(On_Attack_Timeout));
        }
Пример #4
0
 static public bool Intersects(this Circle circle, RangeArea rangeArea) => Intersects(rangeArea, circle);
Пример #5
0
 static public bool Intersects <T>(this T edgedShape, RangeArea rangeArea) where T : IEdgedShape => Intersects(rangeArea, edgedShape);
Пример #6
0
        static public bool Intersects(this RangeArea rangeArea, Circle circle)
        {
            float centerCoordinate = circle.Center.Coordinate(rangeArea.Axis);

            return(new Range <float>(centerCoordinate - circle.Radius, centerCoordinate + circle.Radius).Intersects(rangeArea));
        }
Пример #7
0
 static public bool Intersects <T>(this RangeArea rangeArea, T edgedShape)
     where T : IEdgedShape
 {
     return(Range <float> .FromValues(edgedShape.Vertices.Select(x => x.Coordinate(rangeArea.Axis))).Intersects(rangeArea));
 }