Example #1
0
    public void DrawPath()
    {
        Cell destination = null;

        if (CurrentRange.Contains(MouseToCell()))
        {
            if (arrow != null)
            {
                ClearDrawnPath();
            }
            arrow = new List <Cell>();

            destination = MouseToCell();
        }
        else
        {
            return;
        }

        CurrentPath = QPath.FindPath(Fighter, Map.UnitTile(Fighter), destination, Cell.EstimateDistance);

        if (CurrentPath.Length == 1)
        {
            return;
        }

        foreach (Cell c in CurrentPath)
        {
            GameObject a = null;

            if (!ObjectPool.ContainsKey("arrow") || ObjectPool.GetFirstInactiveObject("arrow") == null)
            {
                a = Instantiate(arrowPrefab, new Vector3(c.position.x, c.position.y), Quaternion.identity);
            }
            else
            {
                a = ObjectPool.GetFirstInactiveObject("arrow");
            }

            ArrowDisplay display = a.GetComponent <ArrowDisplay>();

            arrow.Add(display);
            display.layer = arrowLayer;
            Map.Add(display, arrowLayer, true);

            a.GetComponent <SpriteRenderer>().enabled = false;

            a.transform.position = new Vector3(c.position.x, c.position.y);
            a.SetActive(true);

            display.AssignSprite();
            a.GetComponent <SpriteRenderer>().enabled = true;

            ObjectPool.AddToPool("arrow", a);
        }
    }
Example #2
0
 public void Apply(ISplitButton Import)
 {
     this._borderTop       = Import._borderTop;
     this._borderBottom    = Import._borderBottom;
     this._borderAngle     = Import._borderAngle;
     this._borderBlend     = Import._borderBlend;
     this._hoverBackTop    = Import._hoverBackTop;
     this._hoverBackBottom = Import._hoverBackBottom;
     this._clickBackTop    = Import._clickBackTop;
     this._clickBackBottom = Import._clickBackBottom;
     this._backAngle       = Import._backAngle;
     this._backBlend       = Import._backBlend;
     this._blendRender     = Import._blendRender;
     this._curve           = Import._curve;
     this._arrowDisplay    = Import._arrowDisplay;
     this._arrowColor      = Import._arrowColor;
 }
Example #3
0
        /// <summary>
        /// Imports the settings from a previous or pre-defined ISplitButton and applies it to the current
        /// </summary>
        /// <param name="Import">The ISplitButton to import the settings from</param>
        public void Apply(ISplitButton Import)
        {
            _borderTop = Import._borderTop;
            _borderBottom = Import._borderBottom;
            _borderAngle = Import._borderAngle;
            _borderBlend = Import._borderBlend;

            _hoverBackTop = Import._hoverBackTop;
            _hoverBackBottom = Import._hoverBackBottom;
            _clickBackTop = Import._clickBackTop;
            _clickBackBottom = Import._clickBackBottom;

            _backAngle = Import._backAngle;
            _backBlend = Import._backBlend;

            _blendRender = Import._blendRender;
            _curve = Import._curve;

            _arrowDisplay = Import._arrowDisplay;
            _arrowColor = Import._arrowColor;
        }
 void Awake()
 {
     arrowMove    = GetComponent <ArrowMove>();
     arrowDisplay = GetComponent <ArrowDisplay>();
 }