예제 #1
0
    public void move(HexPosition[] path)
    {
        if (path.Length < 2)
        {
            state = State.ATTACK;
            return;
        }
        HexPosition destination = path [path.Length - 1];

        this.path = new Vector3[path.Length];
        for (int i = 0; i < path.Length; ++i)
        {
            this.path [i] = path [i].getPosition();
        }
        state = State.ATTACK;
        if (destination.containsKey("Unit"))
        {
            print("ERROR: Space occupied.");
            moveComplete();
            return;
        }
        position.remove("Unit");
        destination.add("Unit", this);
        //transform.position = desitination.getPosition();
        t        = 0;
        n        = 0;
        moving   = true;
        position = destination;
    }
예제 #2
0
 public void undoMovement(HexPosition pos)
 {
     state = State.MOVE;
     position.remove("Unit");
     pos.add("Unit", this);
     SetPosition(pos);
     moving = false;
 }
예제 #3
0
    public void Die(string damageSource = "Unknown")
    {
        hexPos.remove(GameBoard.KEY_UNIT_AIR);
        altitude = 0;
        speed    = 0;

        if (deathSubscribers != null)
        {
            deathSubscribers.Invoke(this, damageSource);
        }
    }