Example #1
0
    //ユニット情報を登録(type 1:歩兵/2:車両/3:飛行機/4:船舶)
    public UnitObj AddUnit(String name, Vector2Int point, PlayerCtl player, Unit type)
    {
        //UnitObj unit = Instantiate(baseUnit);
        //unit.Initialize(name, type, point, player, moveAmount, hp, fuel, atkmin, atkmax, atk, image);
        UnitObj unit = UnitObj.Create(name, type, point, player);

        //unit.gameObject.SetActive(true);
        //if (player.pnum == 0){
        //    unit.GetComponent<SpriteRenderer>().color = new Color(0.75f, 0.0f, 0.0f, 1.0f); //red transform.Find("Texture").
        //} else {
        //    unit.transform.GetComponent<SpriteRenderer>().color = new Color(0.0f, 0.0f, 0.75f, 1.0f); //blue
        //}
        //unit.transform.position = map.GetComponent<Grid>().GetCellCenterWorld( new Vector3Int( MapCtl.offset_stg2tile_x(point.x), MapCtl.offset_stg2tile_y(point.y), 0 ) ) - new Vector3(0f, 0f, 1f);
        //if (unit.type != uType.Building){
        //	UnitList[player.pnum].Insert(0, unit);  //先頭
        //} else {
        //	UnitList[player.pnum].Add(unit);  //末尾
        //}
        return(unit);
    }