Esempio n. 1
0
    public void StartMovement(HexNode node)
    {
        this.ResetTimer();
        this.movementLineRenderer.positionCount += 1;
        this.hexNodes.Clear();
        this.movementStarted = true;
        this.hexNodes.Add(node);
        this.trackNodeType = node.nodeType;

        // node.GetComponent<Image>().color = Color.gray;
        node.Focus();

        node.IsSelected = true;
        this.movementLineRenderer.SetPosition(this.hexNodes.Count - 1, node.transform.position);
    }
Esempio n. 2
0
    public void PassThrough(HexNode node)
    {
        this.ResetTimer();
        if (this.movementStarted && node.nodeType == this.trackNodeType)
        {
            if (node.IsSelected)
            {
                if (this.hexNodes.Count > 1)
                {
                    if (node == this.hexNodes[this.hexNodes.Count - 2])
                    {
                        this.hexNodes[this.hexNodes.Count - 1].IsSelected = false;
                        this.hexNodes[this.hexNodes.Count - 1].Reset();
                        this.hexNodes.RemoveAt(this.hexNodes.Count - 1);
                        this.movementLineRenderer.positionCount -= 1;
                        return;
                    }
                }
            }
            else if (!node.IsSelected)
            {
                if (Vector2.Distance(node.transform.position, this.hexNodes.Last().transform.position) <= this.minHexDistanceCheck)
                {
                    if (!node.IsSelected && !this.hexNodes.Contains(node))
                    {
                        this.movementLineRenderer.positionCount += 1;
                        this.hexNodes.Add(node);
                        node.IsSelected = true;

                        // node.GetComponent<Image>().color = Color.gray;
                        node.Focus();
                        this.movementLineRenderer.SetPosition(this.hexNodes.Count - 1, node.transform.position);
                    }
                }
            }
        }
    }