コード例 #1
0
    public static void MoveUnit(HexTile moveToThisHex)
    {
        //  currentActiveUnit.Target = moveToThisHex.transform.position;

        if (HexEngine.instance.Spaces.ContainsKey(moveToThisHex.transform.ToGridVector3Int()))
        {
            PathFinderSimple pf = new PathFinderSimple(HexEngine.instance.Spaces);
            var path            = pf.GetPath(currentActiveUnit.transform.ToGridVector3Int(), moveToThisHex.transform.ToGridVector3Int()).ToList();

            currentActiveUnit.SetPath(path);
        }



        currentActiveUnit.currentHex.pairedUnit = null;
        currentActiveUnit.currentHex            = moveToThisHex;
        moveToThisHex.pairedUnit = currentActiveUnit;
        if (moveToThisHex.pairedObject != null)
        {
            if (moveToThisHex.pairedObject.pairType == PairType.WitchBase)
            {
                PlaceUnitInBase(moveToThisHex.pairedObject.GetComponent <WitchBase>());
            }
        }
        ClearNeighbours();
        if (currentActiveUnit != null)
        {
            currentActiveUnit = null;
        }
    }
コード例 #2
0
    public static void BeginMovement(WitchUnit wUnit)
    {
        currentActiveUnit = wUnit;
        HexEngine         hEngine    = HexEngine.instance;
        MapPresets        mPresets   = hEngine.mapPresets;
        List <Vector3Int> neighbours = HexEngine.instance.GetNeighbors(currentActiveUnit.currentHex.Coordinates);

        ShowNeighbours(neighbours, hEngine);
    }
コード例 #3
0
    public void IssueLeaveBaseOrder()
    {
        Witch      witch         = mainUI.witch;
        WitchBase  thisWitchBase = GetComponentInParent <WitchSelectUI>().witchBase;
        GameObject goWUnit       = Instantiate(witchUnit);
        //wUnit.transform.position = thisWitchBase.transform.position
        WitchUnit wUnit = goWUnit.GetComponent <WitchUnit>();

        wUnit.witch = witch;
        wUnit.SetupWitchColours();
        thisWitchBase.witches.Remove(witch);
        wUnit.currentHex = thisWitchBase.pairedToThisTile;
        UnitMovement.BeginMovement(wUnit);
        Destroy(GetComponentInParent <WitchBaseUI>().gameObject);
    }