Esempio n. 1
0
    public List <Point2> GetCanMovePoint(Unit _unit)
    {
        List <Point2> standingList  = CompornentUtility.FindCompornentOnScene <UnitManager>().GetStandingPoints();
        List <Point2> canMovePoints = new List <Point2>();
        Point2        pivot         = _unit.pos;
        int           moveRange     = _unit.GetUnitStatus.moveRange;
        var           crossPoints   = StageUtility.GetCrossPoint(pivot, moveRange);

        foreach (var point in crossPoints)
        {
            //既にunitがいた場合continue
            if (standingList.Contains(point))
            {
                continue;
            }
            //たどり着けるかチェック
            var pathList = pathCreater.GetPath(_unit.pos, point, _unit.GetUnitStatus.stepHeight);
            if (pathList == null)
            {
                continue;
            }
            //unitの設定歩数で行けるかチェック
            if (pathList.Count > moveRange)
            {
                continue;
            }
            canMovePoints.Add(point);
        }
        return(canMovePoints);
    }
Esempio n. 2
0
 private void Awake()
 {
     mover         = new Mover(this);
     maxUnitStatus = unitStatus;
     CompornentUtility.FindCompornentOnScene <UnitManager>().AddUnit(this);
     CompornentUtility.FindCompornentOnScene <SetUpManager>().AddSetUpAction(SetUp);
 }
    void SetUp()
    {
        var unit = CompornentUtility.FindCompornentOnScene <UnitSelector>().ActivUnit;

        unitBehaviour = new MoveBehaviour(unit);
        unitBehaviour.SetUp();
    }
Esempio n. 4
0
    public static List <Point2> GetCrossPoint(Point2 pivot_point, int _range)
    {
        Point2 pivot     = pivot_point;
        int    moveRange = _range;
        var    blocks    = CompornentUtility.FindCompornentOnScene <BattleStage>().Blocks;
        var    pointList = new List <Point2>();

        for (int i = pivot.x - moveRange; i <= pivot.x + moveRange; i++)
        {
            for (int k = pivot.y - moveRange; k <= pivot.y + moveRange; k++)
            {
                var point = new Point2(i, k);
                //十字チェック
                if (!IsInnerOnCross(point, pivot, moveRange))
                {
                    continue;
                }
                //blockがあるかチェック
                if (!blocks.ContainsKey(point))
                {
                    continue;
                }
                pointList.Add(point);
            }
        }
        return(pointList);
    }
Esempio n. 5
0
    // Use this for initialization
    void Start()
    {
        var sc = CompornentUtility.FindCompornentOnScene <StageCreater>();

        sc.CreateStage();
        var bs = CompornentUtility.FindCompornentOnScene <BattleStage>();

        CompornentUtility.FindCompornentOnScene <PathCreater>().CreateNodes(bs.Blocks);
    }
Esempio n. 6
0
    public GameObject PopPanel(Point2 _point)
    {
        var     battleStage = CompornentUtility.FindCompornentOnScene <BattleStage>();
        Vector3 pos         = battleStage.GetBlockPosition(_point);
        var     obj         = Instantiate(LightPanelPre);

        obj.transform.position = pos;
        return(obj);
    }
Esempio n. 7
0
 // Update is called once per frame
 private void Update()
 {
     if (unitBehaviour.Update())
     {
         unitBehaviour.End();
         CompornentUtility.FindCompornentOnScene <TurnManager>().NextTurn();
         UnitSetUp();
     }
 }
Esempio n. 8
0
    public void SetUp()
    {
        var lpp             = CompornentUtility.FindCompornentOnScene <LightPanelPopper>();
        var unitMoveChecker = CompornentUtility.FindCompornentOnScene <UnitMoveChecker>();

        canMovePoints = unitMoveChecker.GetCanMovePoint(unit);
        foreach (var p in canMovePoints)
        {
            lpp.ActiveOn(p, Color.blue);
        }
    }
Esempio n. 9
0
    public void SetUp()
    {
        var lpp             = CompornentUtility.FindCompornentOnScene <LightPanelPopper>();
        var unitMoveChecker = CompornentUtility.FindCompornentOnScene <UnitMoveChecker>();

        canMovePoints = unitMoveChecker.GetCanMovePoint(unit);
        foreach (var i in canMovePoints)
        {
            panelList.Add(lpp.PopPanel(i));
        }
    }
Esempio n. 10
0
    void CreatePanels()
    {
        var bs = CompornentUtility.FindCompornentOnScene <BattleStage>();

        foreach (var b in bs.Blocks)
        {
            var bp = Instantiate(LightPanelPre);
            bp.transform.position = b.Value.transform.position;
            panelDic.Add(b.Key, bp);
            bp.SetActive(false);
        }
    }
Esempio n. 11
0
    IEnumerator OneMove(Point2 next_point)
    {
        var   bStage = CompornentUtility.FindCompornentOnScene <BattleStage>();
        var   sub    = bStage.GetBlockPosition(next_point) - myUnit.transform.position;
        float sec    = 0;

        while (sec <= 1.0f)
        {
            myUnit.transform.position += sub * Time.deltaTime * moveSpeed;
            sec += Time.deltaTime * moveSpeed;
            yield return(null);
        }
    }
Esempio n. 12
0
    void BehaviourSetUp()
    {
        TurnManager.Instance.NextTurn();
        var unit = CompornentUtility.FindCompornentOnScene <UnitSelector>().ActivUnit;

        if (unit.Army == PlayerInfo.Instance.team)
        {
            unitBehaviour = new MoveBehaviour(unit);
        }
        else
        {
        }
        unitBehaviour.SetUp();
    }
Esempio n. 13
0
 public void CreateStage()
 {
     battleStage = CompornentUtility.FindCompornentOnScene <BattleStage>();
     for (int x = 0; x < map.GetLength(0); x++)
     {
         for (int y = 0; y < map.GetLength(1); y++)
         {
             int        mapType    = map[x, y];
             int        mapHeight  = heightmap[x, y];
             GameObject blockPre   = GetPreBlock(mapType);
             Point2     blockPoint = new Point2(x, y);
             CreateBlock(blockPre, blockPoint, mapHeight);
         }
     }
 }
Esempio n. 14
0
    public void MoveToPoint(Point2 _point)
    {
        if (isMoving)
        {
            return;
        }
        PathCreater pathCre = CompornentUtility.FindCompornentOnScene <PathCreater>();
        var         path    = pathCre.GetPath(myUnit.pos, _point, myUnit.GetMaxUnitStatus.stepHeight);

        if (path != null)
        {
            myUnit.pos = _point;
            myUnit.StartCoroutine(MoveRoutine(path));
        }
    }
Esempio n. 15
0
    void BehaviourSetUp()
    {
        TurnManager.Instance.NextTurn();
        var unit = CompornentUtility.FindCompornentOnScene <UnitSelector>().ActivUnit;

        unitBehaviour = new MoveBehaviour(unit);
        //if (unitBehaviour!=null&&unitBehaviour.GetType() == typeof(MoveBehaviour))
        //{
        //    unitBehaviour = new AttackBehaviour(unit);
        //}
        //else
        //{
        //    TurnManager.Instance.NextTurn();
        //    unitBehaviour = new MoveBehaviour(unit);
        //}
        unitBehaviour.SetUp();
    }
Esempio n. 16
0
 private void Awake()
 {
     battleStage = CompornentUtility.FindCompornentOnScene <BattleStage>();
     pathCreater = CompornentUtility.FindCompornentOnScene <PathCreater>();
 }
Esempio n. 17
0
 void SetUp()
 {
     transform.position = CompornentUtility.FindCompornentOnScene <BattleStage>().GetBlockPosition(pos);
 }
Esempio n. 18
0
    private void SetUpTurn()
    {
        var unitManager = CompornentUtility.FindCompornentOnScene <UnitManager>();

        turn.SetList(unitManager.GetArmyList());
    }
Esempio n. 19
0
 private void Awake()
 {
     CompornentUtility.FindCompornentOnScene <SetUpManager>().AddSetUpAction(CreatePanels);
 }
Esempio n. 20
0
    public void End()
    {
        var lpp = CompornentUtility.FindCompornentOnScene <LightPanelPopper>();

        lpp.AllActiveOff();
    }
Esempio n. 21
0
 // Use this for initialization
 private void Awake()
 {
     CompornentUtility.FindCompornentOnScene <SetUpManager>().AddSetUpAction(SetUp);
     StartCoroutine(BehaviourRoutine());
 }
Esempio n. 22
0
 // Use this for initialization
 void Start()
 {
     turnManager = CompornentUtility.FindCompornentOnScene <TurnManager>();
     unitManager = CompornentUtility.FindCompornentOnScene <UnitManager>();
 }
Esempio n. 23
0
    public void Effect(List <Point2> p_list)
    {
        var units = CompornentUtility.FindCompornentOnScene <UnitManager>().GetStandingUnits(p_list);

        Effect(units);
    }
Esempio n. 24
0
 private void Start()
 {
     myUnit    = GetComponent <CharacterUnit>();
     agent     = GetComponent <NavMeshAgent>();
     unitlists = CompornentUtility.FindCompornentOnScene <UnitListCabinet>();
 }
Esempio n. 25
0
 // Use this for initialization
 private void Start()
 {
     CompornentUtility.FindCompornentOnScene <SetUpManager>().AddSetUpAction(UnitSetUp);
 }