示例#1
0
    public override void Death()
    {
        for (int i = 0; i < Tactical_Head.GetPlayerCount(); i++)
        {
            Unit_Manager Enemy = Tactical_Head.GetPlayer(i);
            if (Mathf.Abs(x - Enemy.x) <= 3 && Mathf.Abs(y - Enemy.y) <= 3)
            {
                Enemy.pressure -= 10;
            }
        }

        for (int i = 0; i < Tactical_Head.GetEnemyCount(); i++)
        {
            Unit_Manager Team = Tactical_Head.GetEnemy(i);
            if (Mathf.Abs(x - Team.x) <= 1 && Mathf.Abs(y - Team.y) <= 1)
            {
                Team.pressure += 30;
            }
        }

        _Input.EnemyView -= Sight;
        SEE_ALL          -= Seek;

        Tactical_Head.DeleteEnemy(this);
        base.Death();
    }
示例#2
0
 public static void AddPlayer(Unit_Manager _Player)
 {
     if (_Players == null)
     {
         _Players = new List <Unit_Manager>();
     }
     _Players.Add(_Player);
 }
示例#3
0
    private void Update()
    {
        if (!transform.parent.CompareTag("Player"))
        {
            return;
        }
        if (Btn1 || Btn2 || Btn3)
        {
            Cursor_Manager.m_Cursor_Manager.SetCursor(_UI.Cursors[0]);
        }
        if (Input.GetMouseButtonDown(0))
        {
            if (Btn1 || Btn2 || Btn3)
            {
                Vector2      pos = _Input.pos;
                RaycastHit2D hit = _Input.hit_Player;

                if (hit.transform != null && hit.transform.tag == "Enemy")
                {
                    Unit_Manager _Unit = hit.transform.GetComponent <Unit_Manager>();
                    if (Mathf.Abs(_Unit.x - Unit.x) + Mathf.Abs(_Unit.y - Unit.y) <= Range)
                    {
                        if (Btn1)
                        {
                            _Unit.Hit(this);
                            Bullet--;
                            _UI._Clip.text = Bullet.ToString();
                            Aim_Bonus      = 0;
                        }
                        else if (Btn2)
                        {
                            StartCoroutine(_BTN2(_Unit));
                        }
                        else
                        {
                            _Unit.Hit(this);
                            Bullet--;
                            _UI._Clip.text = Bullet.ToString();
                            Aim_Bonus      = 0;
                        }

                        if (Btn2)
                        {
                            Unit.Now_Action_Point -= 2;
                        }
                        Unit.Now_Action_Point -= 3;


                        Action = false;
                        Btn1   = false;
                        Btn3   = false;
                        Cursor_Manager.m_Cursor_Manager.SetCursor(_UI.Cursors[1]);
                        Unit.DrawActionPoint();
                    }
                }
            }
        }
    }
示例#4
0
    public override bool Rand(Unit_Manager _Unit)
    {
        base.Rand(_Unit);

        if (Bullet >= 1 && Unit.Now_Action_Point >= 6)
        {
            switch (Random.Range(1, 3))
            {
            case 1:
                BTN1();
                break;

            case 2:
                BTN2();
                break;
            }
        }
        else if (Bullet >= 1 && Unit.Now_Action_Point >= 3)
        {
            BTN1();
        }
        else if (Unit.Now_Action_Point >= 3)
        {
            BTN3();
        }
        else
        {
            return(false);
        }

        if (Btn1 || Btn2)
        {
            if (Mathf.Abs(_Unit.x - Unit.x) - Mathf.Abs(_Unit.y - Unit.y) <= Range)
            {
                _Unit.Hit(this);
                Action = false;

                if (Btn2)
                {
                    Unit.Now_Action_Point -= 3;
                }
                Unit.Now_Action_Point -= 3;

                Btn2 = false;
                Btn1 = false;

                Bullet--;
                Aim_Bonus = 0;
            }
            else
            {
                Unit.Now_Action_Point = 0;
            }
        }

        return(true);
    }
示例#5
0
    public override bool CoverCheck(Unit_Manager _Unit)
    {
        if (_Posture == Posture.Prone)
        {
            return(true);
        }

        return(ChangePos(Posture.Prone));
    }
示例#6
0
    public virtual bool Rand(Unit_Manager _Unit)
    {
        if (Unit.Partner != null)
        {
            Unit.Now_Action_Point = 0;
        }

        return(false);
    }
示例#7
0
    public void MakeByPass(Unit_Manager _Player)
    {
        ByPassGoal = new Vector2[] { Vector2.zero, Vector2.zero };
        if (Mathf.Abs(_this.x - _Player.x) <= Mathf.Abs(_this.y - _Player.y))
        {
            if (Mathf.Abs(_this.x - _Tile.X) >= _this.x)
            {
                ByPassGoal[0].x = 0;
                ByPassGoal[0].y = _this.y;
            }
            else
            {
                ByPassGoal[0].x = _Tile.X - 1;
                ByPassGoal[0].y = _this.y;
            }

            ByPassGoal[1].x = ByPassGoal[0].x;
            if (_this.y >= _Player.y)
            {
                Locate          = 2;
                ByPassGoal[1].y = 0;
            }
            else
            {
                Locate          = 1;
                ByPassGoal[1].y = _Tile.Y - 1;
            }
        }
        else
        {
            if (Mathf.Abs(_this.y - _Tile.Y) >= _this.y)
            {
                Locate          = 1;
                ByPassGoal[0].y = 0;
                ByPassGoal[0].x = _this.x;
            }
            else
            {
                Locate          = 2;
                ByPassGoal[0].y = _Tile.Y - 1;
                ByPassGoal[0].x = _this.x;
            }

            ByPassGoal[1].y = ByPassGoal[0].y;
            if (_this.x >= _Player.x)
            {
                Locate          = 2;
                ByPassGoal[1].x = 0;
            }
            else
            {
                Locate          = 1;
                ByPassGoal[1].x = _Tile.X - 1;
            }
        }
    }
示例#8
0
    private void Update()
    {
        if (!transform.parent.CompareTag("Player"))
        {
            return;
        }
        if (Btn1 || Btn2 || Btn3)
        {
            Cursor_Manager.m_Cursor_Manager.SetCursor(_UI.Cursors[0]);
        }
        if (Input.GetMouseButtonDown(0))
        {
            if ((Btn1 || Btn2 || Btn3) && !Shooting)
            {
                Vector2      pos = _Input.pos;
                RaycastHit2D hit = _Input.hit_Player;

                if (hit.transform != null && hit.transform.tag == "Enemy")
                {
                    Unit_Manager _Unit = hit.transform.GetComponent <Unit_Manager>();
                    if (Mathf.Abs(_Unit.x - Unit.x) + Mathf.Abs(_Unit.y - Unit.y) <= Range)
                    {
                        if (Btn1)
                        {
                            StartCoroutine(_BTN1(_Unit, Bullet));
                        }
                        else if (Btn2)
                        {
                            StartCoroutine(_BTN2(_Unit));
                        }
                        else
                        {
                            StartCoroutine(_BTN3(_Unit, Bullet));
                        }

                        if (Btn2 || Btn3)
                        {
                            Unit.Now_Action_Point -= 3;
                        }
                        Unit.Now_Action_Point -= 3;

                        Unit.DrawActionPoint();
                        Cursor_Manager.m_Cursor_Manager.SetCursor(_UI.Cursors[1]);
                    }
                }
            }
        }
    }
示例#9
0
 IEnumerator _BTN3(Unit_Manager _Unit)
 {
     for (int i = 0; i < 50; i++)
     {
         if (_Unit != null)
         {
             _Unit.Hit(this);
             Bullet--;
             _UI._Clip.text = Bullet.ToString();
         }
         yield return(new WaitForSeconds(0.1f));
     }
     Aim_Bonus = 0;
     Action    = false;
     Btn3      = false;
 }
示例#10
0
    public override bool CoverCheck(Unit_Manager _Unit)
    {
        if (_Posture == Posture.Prone)
        {
            for (int i = 0; i < View_Manager.Enemys.Count; i++)
            {
                if (View_Manager.Enemys[i] == this.transform)
                {
                    return(base.CoverCheck(_Unit, 1));
                }
            }

            return(true);
        }

        ChangePos(Posture.Prone);
        return(false);
    }
示例#11
0
    public override void Death()
    {
        for (int i = 0; i < Tactical_Head.GetPlayerCount(); i++)
        {
            Unit_Manager Team = Tactical_Head.GetPlayer(i);
            if (Mathf.Abs(x - Team.x) <= 1 && Mathf.Abs(y - Team.y) <= 1)
            {
                Team.pressure += 30;
            }
        }

        for (int i = 0; i < Tactical_Head.GetEnemyCount(); i++)
        {
            Unit_Manager Enemy = Tactical_Head.GetEnemy(i);
            if (Mathf.Abs(x - Enemy.x) <= 3 && Mathf.Abs(y - Enemy.y) <= 3)
            {
                Enemy.pressure -= 10;
            }
        }
        base.Death();
    }
示例#12
0
    IEnumerator _BTN4(Unit_Manager _Unit, int _Bullet)
    {
        for (int i = 0; i < _Bullet; i++)
        {
            if (i >= 20)
            {
                break;
            }

            if (_Unit != null)
            {
                _Unit.Hit(this);
                Bullet--;
                _UI._Clip.text = Bullet.ToString();
            }
            yield return(new WaitForSeconds(0.1f));
        }
        Aim_Bonus = 0;
        Action    = false;
        Btn4      = false;
        yield return(null);
    }
示例#13
0
    public void UnSight(Unit_Manager _Action)
    {
		//Action = GameObject.Find("Player(Clone)").GetComponent<Action_Manager>();
		//Debug.Log(Action.x + "/" + Action.y + " - " + X +"/" + Y + " = " + (Mathf.Abs(Action.x - X) + Mathf.Abs(Action.y - Y)));
		if (Mathf.Abs(_Action.x - X) + Mathf.Abs(_Action.y - Y) >= _Action.View.ViewRange)
		{
            
			if (View_Char.Contains(_Action.Char_Num)) View_Char.Remove(_Action.Char_Num);
			UnView();
		}

        if ((_Action.dir == Unit_Manager.Direction.left && X > _Action.x) ||
            (_Action.dir == Unit_Manager.Direction.right && X < _Action.x) ||
            (_Action.dir == Unit_Manager.Direction.down && Y > _Action.y) ||
            (_Action.dir == Unit_Manager.Direction.up && Y < _Action.y))
        {
            if (View_Char.Contains(_Action.Char_Num)) View_Char.Remove(_Action.Char_Num);
            UnView();
        }

        //Action = null;
    }
示例#14
0
    // Update is called once per frame
    void Update()
    {
        if (!transform.parent.CompareTag("Player"))
        {
            return;
        }
        Vector2      pos = _Input.pos;
        RaycastHit2D hit = _Input.hit_Tile;


        if (Btn1)
        {
            if (Input_Manager.Highlighted != null)
            {
                Input_Manager.Highlighted();
                Input_Manager.Highlighted = null;
            }
            Cursor_Manager.m_Cursor_Manager.SetCursor(UI_MANAGER.m_UI_MANAGER.Cursors[0]);



            if (hit.transform != null && hit.transform.tag == "Tile")
            {
                Tile _Tile = hit.transform.GetComponent <Tile>();

                if (Mathf.Abs(_Tile.X - Unit.x) + Mathf.Abs(_Tile.Y - Unit.y) <= Weapon.Range)
                {
                    for (int x = _Tile.X - 1; x <= _Tile.X + 1; x++)
                    {
                        if (x < 0 || x >= Tile_Manager.m_Tile_Manager.X)
                        {
                            continue;
                        }
                        for (int y = _Tile.Y - 1; y <= _Tile.Y + 1; y++)
                        {
                            if (y < 0 || y >= Tile_Manager.m_Tile_Manager.Y)
                            {
                                continue;
                            }
                            if (x != _Tile.X && y != _Tile.Y)
                            {
                                continue;
                            }

                            Tile N_Tile = Tile_Manager.m_Tile_Manager.MY_Tile[x][y];

                            N_Tile.HighLight(1);
                        }
                    }
                }
            }
        }
        if (Input.GetMouseButtonDown(0))
        {
            if (Btn1)
            {
                if (hit.transform != null && hit.transform.tag == "Tile")
                {
                    Tile _Tile = hit.transform.GetComponent <Tile>();

                    if (Mathf.Abs(_Tile.X - Unit.x) + Mathf.Abs(_Tile.Y - Unit.y) <= Weapon.Range)
                    {
                        for (int x = _Tile.X - 1; x <= _Tile.X + 1; x++)
                        {
                            for (int y = _Tile.Y - 1; y <= _Tile.Y + 1; y++)
                            {
                                Weapon.HeadShot_Bonus = 0;
                                if (x < 0 || x >= _Tile._Tile.X || y < 0 || y >= _Tile._Tile.Y)
                                {
                                    continue;
                                }
                                if (x != _Tile.X && y != _Tile.Y)
                                {
                                    continue;
                                }

                                _Tile._Tile.MY_Tile[x][y].DownGrade();

                                if (_Tile._Tile.MY_Tile[x][y].transform.childCount > 0)
                                {
                                    if (_Tile._Tile.MY_Tile[x][y].transform.Find("Enemy(Clone)") != null)
                                    {
                                        Unit_Manager _Unit = _Tile._Tile.MY_Tile[x][y].transform.Find("Enemy(Clone)").GetComponent <Unit_Manager>();
                                        if (_Unit != null)
                                        {
                                            if (x == _Tile.X && y == _Tile.Y)
                                            {
                                                Weapon.HeadShot_Bonus = 100;
                                            }

                                            _Unit.Hit(Weapon);
                                        }
                                    }
                                    else if (_Tile._Tile.MY_Tile[x][y].transform.Find("Player(Clone)") != null)
                                    {
                                        Unit_Manager _Unit = _Tile._Tile.MY_Tile[x][y].transform.Find("Player(Clone)").GetComponent <Unit_Manager>();
                                        if (_Unit != null)
                                        {
                                            if (x == _Tile.X && y == _Tile.Y)
                                            {
                                                Weapon.HeadShot_Bonus = 100;
                                            }

                                            _Unit.Hit(Weapon);
                                        }
                                    }
                                }
                            }
                        }

                        Unit.Tile_InSighted = null;
                        Unit.View.InView();

                        Unit.Now_Action_Point -= 3;
                        Unit.DrawActionPoint();

                        Btn1   = false;
                        Action = false;
                        count--;

                        Cursor_Manager.m_Cursor_Manager.SetCursor(UI_MANAGER.m_UI_MANAGER.Cursors[1]);

                        if (count <= 0)
                        {
                            Unit.Items.Remove(this);
                            Unit.Select();
                            Destroy(gameObject);
                        }
                    }
                }
            }
        }
    }
示例#15
0
    public override bool Rand(Enemy_Manager _this)
    {
        base.Rand(_this);
        if (Unit.Now_Action_Point < 3 || Action)
        {
            return(false);
        }

        Unit_Manager CloserPlayer = _this.GetMeetPlayer()[_this.CloserPlayer()];

        if (Mathf.Abs(CloserPlayer.x - _this.x) + Mathf.Abs(CloserPlayer.y - _this.y) <= Weapon.Range)
        {
            Tile _Tile = CloserPlayer.T;

            for (int x = _Tile.X - 1; x <= _Tile.X + 1; x++)
            {
                for (int y = _Tile.Y - 1; y <= _Tile.Y + 1; y++)
                {
                    Weapon.HeadShot_Bonus = 0;
                    if (x < 0 || x >= _Tile._Tile.X || y < 0 || y >= _Tile._Tile.Y)
                    {
                        continue;
                    }
                    if (x != _Tile.X && y != _Tile.Y)
                    {
                        continue;
                    }

                    _Tile._Tile.MY_Tile[x][y].DownGrade();

                    if (_Tile._Tile.MY_Tile[x][y].transform.childCount > 0)
                    {
                        if (_Tile._Tile.MY_Tile[x][y].transform.Find("Enemy(Clone)") != null)
                        {
                            Unit_Manager _Unit = _Tile._Tile.MY_Tile[x][y].transform.Find("Enemy(Clone)").GetComponent <Unit_Manager>();
                            if (_Unit != null)
                            {
                                if (x == _Tile.X && y == _Tile.Y)
                                {
                                    Weapon.HeadShot_Bonus = 100;
                                }

                                _Unit.Hit(Weapon);
                            }
                        }
                        else if (_Tile._Tile.MY_Tile[x][y].transform.Find("Player(Clone)") != null)
                        {
                            Unit_Manager _Unit = _Tile._Tile.MY_Tile[x][y].transform.Find("Player(Clone)").GetComponent <Unit_Manager>();
                            if (_Unit != null)
                            {
                                if (x == _Tile.X && y == _Tile.Y)
                                {
                                    Weapon.HeadShot_Bonus = 100;
                                }

                                _Unit.Hit(Weapon);
                            }
                        }
                    }
                }
            }

            _this.Now_Action_Point -= 3;

            Btn1   = false;
            Action = false;
            count--;

            Cursor_Manager.m_Cursor_Manager.SetCursor(UI_MANAGER.m_UI_MANAGER.Cursors[1]);

            if (count <= 0)
            {
                _this.Items.Remove(this);
                Destroy(gameObject);
            }
        }
        return(true);
    }
示例#16
0
 public void Death(Unit_Manager _Unit)
 {
     Sequence.Remove((Unit_List.IndexOf(_Unit) + 1));
     Unit_List[Unit_List.IndexOf(_Unit)] = null;
 }
示例#17
0
 public void AddUnit(Unit_Manager _Unit)
 {
     Unit_List.Add(_Unit);
     Sequence.Add(Unit_List.Count);
 }
示例#18
0
    public override bool Rand(Unit_Manager _Unit)
    {
        base.Rand(_Unit);

        if (Bullet > 19 && Unit.Now_Action_Point >= 6)
        {
            switch (Random.Range(1, 4))
            {
            case 1:
                BTN1();
                break;

            case 2:
                BTN2();
                break;

            case 3:
                BTN3();
                break;
            }
        }
        else if (Bullet >= 15 && Unit.Now_Action_Point >= 6)
        {
            switch (Random.Range(1, 3))
            {
            case 1:
                BTN1();
                break;

            case 2:
                BTN2();
                break;
            }
        }
        else if (Bullet > 0 && Unit.Now_Action_Point >= 3)
        {
            BTN1();
        }
        else if (Unit.Now_Action_Point >= 3)
        {
            BTN4();
        }
        else
        {
            return(false);
        }

        if (Btn1 || Btn2 || Btn3)
        {
            if (Mathf.Abs(_Unit.x - Unit.x) - Mathf.Abs(_Unit.y - Unit.y) <= Range)
            {
                if (Btn1)
                {
                    StartCoroutine(_BTN1(_Unit, Bullet));
                }
                else if (Btn2)
                {
                    StartCoroutine(_BTN2(_Unit));
                }
                else
                {
                    StartCoroutine(_BTN3(_Unit, Bullet));
                }

                if (Btn2 || Btn3)
                {
                    Unit.Now_Action_Point -= 3;
                }
                Unit.Now_Action_Point -= 3;
            }
            else
            {
                Unit.Now_Action_Point = 0;
            }
        }

        return(true);
    }
示例#19
0
 public override bool CoverCheck(Unit_Manager _Unit)
 {
     return(base.CoverCheck(_Unit));
 }
示例#20
0
    public void MakeBehindRoot(Unit_Manager _Player)
    {
        Vector2 _Goal = new Vector2(_this.x, _this.y);
        int     X, Y;

        X = 0;
        Y = 0;
        int deep        = 1;
        int RemainPoint = _this.Now_Action_Point;

        if (Mathf.Abs(_this.x - _Player.x) >= Mathf.Abs(_this.y - _Player.y))
        {
            if (_this.x >= _Player.x)
            {
                X = 1;
            }
            else
            {
                X = -1;
            }
        }
        else
        {
            if (_this.y >= _Player.y)
            {
                Y = 1;
            }
            else
            {
                Y = -1;
            }
        }


        while (RemainPoint > 0)
        {
            RemainPoint--;

            if (_Tile.TileMap[_this.x + (X * deep)][_this.y + (Y * deep)] == Tile_Manager.Cover_Kind.HalfCover)
            {
                if (RemainPoint > 0)
                {
                    RemainPoint--;
                }
                else
                {
                    break;
                }
            }

            if (_this.x + (X * deep) < 0 || _this.x + (X * deep) >= _Tile.X)
            {
                break;
            }
            else if (_this.y + (Y * deep) < 0 || _this.y + (Y * deep) >= _Tile.Y)
            {
                break;
            }

            _Goal.x = _this.x + (X * deep);
            _Goal.y = _this.y + (Y * deep);
            if (Mathf.Abs(_Player.x - (_this.x + (X * deep))) + Mathf.Abs(_Player.y - (_this.y + (Y * deep))) > _Player.View.ViewRange)
            {
                break;
            }
            deep++;
        }
        _this.MakeNav(_Goal);
    }
示例#21
0
    public virtual bool CoverCheck(Unit_Manager _Unit, int behind = 0)
    {
        int         X = 0, Y = 0;
        List <Tile> _Cover = new List <Tile>();

        if (Mathf.Abs(_Unit.x - x) >= Mathf.Abs(_Unit.y - y))
        {
            if (x - _Unit.x > 0)
            {
                if (_Tile.TileMap[x - 1][y] != Tile_Manager.Cover_Kind.CanNot && _Tile.TileMap[x - 1][y] != Tile_Manager.Cover_Kind.Default)
                {
                    return(true);
                }

                if (behind != 1)
                {
                    X = 1;
                }
            }
            else
            {
                if (_Tile.TileMap[x + 1][y] != Tile_Manager.Cover_Kind.CanNot && _Tile.TileMap[x + 1][y] != Tile_Manager.Cover_Kind.Default)
                {
                    return(true);
                }
                X = -1;
            }
        }
        else
        {
            if (y - _Unit.y > 0)
            {
                if (_Tile.TileMap[x][y - 1] != Tile_Manager.Cover_Kind.CanNot && _Tile.TileMap[x][y - 1] != Tile_Manager.Cover_Kind.Default)
                {
                    return(true);
                }

                Y = 1;
            }
            else
            {
                if (_Tile.TileMap[x][y - 1] != Tile_Manager.Cover_Kind.CanNot && _Tile.TileMap[x][y - 1] != Tile_Manager.Cover_Kind.Default)
                {
                    return(true);
                }

                Y = -1;
            }
        }
        int count = -1;

        for (int _x = x - Pull_Action_Point; _x <= x + Pull_Action_Point; _x++)
        {
            count = Mathf.Abs(_x - x);
            if (_x < 0 || _x >= _Tile.X)
            {
                continue;
            }

            for (int _y = y - Pull_Action_Point + count; _y <= y + Pull_Action_Point - count; _y++)
            {
                if (_y < 0 || _y >= _Tile.Y)
                {
                    continue;
                }

                if (_Tile.TileMap[_x][_y] != Tile_Manager.Cover_Kind.CanNot && _Tile.TileMap[_x][_y] != Tile_Manager.Cover_Kind.Default)
                {
                    _Cover.Add(_Tile.MY_Tile[_x][_y]);
                }
            }
        }

        int[] _where = new int[2] {
            -1, -1
        };
        int[] length = new int[2] {
            10, 10
        };
        for (int i = 0; i < _Cover.Count; i++)
        {
            int w = 0; // 0 = behind , 1 = front
            if (X > 0 && _Cover[i].X < x)
            {
                w = 1;
            }
            else if (X < 0 && _Cover[i].X > x)
            {
                w = 1;
            }
            else if (Y > 0 && _Cover[i].Y < y)
            {
                w = 1;
            }
            else if (Y < 0 && _Cover[i].Y > y)
            {
                w = 1;
            }

            if (Mathf.Abs(_Cover[i].X - x) + Mathf.Abs(_Cover[i].Y - y) <= length[w])
            {
                if (_Tile.MY_Tile[_Cover[i].X + X][_Cover[i].Y + Y].transform.Find("Enemy(Clone)") != null ||
                    (_Tile.TileMap[_Cover[i].X + X][_Cover[i].Y + Y] != Tile_Manager.Cover_Kind.CanNot && _Tile.TileMap[_Cover[i].X + X][_Cover[i].Y + Y] != Tile_Manager.Cover_Kind.Default))
                {
                    _Cover.RemoveAt(i);
                    i--;
                }
                else
                {
                    length[w] = Mathf.Abs(_Cover[i].X - x) + Mathf.Abs(_Cover[i].Y - y);
                    _where[w] = i;
                }
            }
        }

        if (behind == 0)
        {
            if (_where[0] != -1)
            {
                realR = Mathf.Abs(x - _Cover[_where[0]].X) + Mathf.Abs(y - _Cover[_where[0]].Y);
                A_Star(_Cover[_where[0]].X + X, _Cover[_where[0]].Y + Y, _Cover[_where[0]].X + X, _Cover[_where[0]].Y + Y, 0, 0);
                cost     = 20000;
                where    = 20000;
                realR    = 10000;
                realDeep = 10000;
                comple   = false;

                return(false);
            }
            else if (_where[1] != -1)
            {
                realR = Mathf.Abs(x - _Cover[_where[1]].X) + Mathf.Abs(y - _Cover[_where[1]].Y);
                A_Star(_Cover[_where[1]].X + X, _Cover[_where[1]].Y + Y, _Cover[_where[1]].X + X, _Cover[_where[1]].Y + Y, 0, 0);
                cost     = 20000;
                where    = 20000;
                realR    = 10000;
                realDeep = 10000;
                comple   = false;

                return(false);
            }
        }
        else
        {
            if (_where[1] != -1)
            {
                realR = Mathf.Abs(x - _Cover[_where[0]].X) + Mathf.Abs(y - _Cover[_where[0]].Y);
                A_Star(_Cover[_where[0]].X + X, _Cover[_where[0]].Y + Y, _Cover[_where[0]].X + X, _Cover[_where[0]].Y + Y, 0, 0);
                cost     = 20000;
                where    = 20000;
                realR    = 10000;
                realDeep = 10000;
                comple   = false;

                return(false);
            }
            else if (_where[0] != -1)
            {
                realR = Mathf.Abs(x - _Cover[_where[1]].X) + Mathf.Abs(y - _Cover[_where[1]].Y);
                A_Star(_Cover[_where[1]].X + X, _Cover[_where[1]].Y + Y, _Cover[_where[1]].X + X, _Cover[_where[1]].Y + Y, 0, 0);
                cost     = 20000;
                where    = 20000;
                realR    = 10000;
                realDeep = 10000;
                comple   = false;

                return(false);
            }
        }



        return(true);
    }
示例#22
0
    public void SQUAD(Unit_Manager _Partner)
    {
        Partner          = _Partner;
        _Partner.Partner = this;
        Inventory.Squad  = null;
        bool check = false;
        int  r     = Random.Range(0, 3);

        while (!check)
        {
            switch (r)
            {
            case 0:
                if (x - 1 >= 0 && (_Tile.TileMap[x - 1][y] == Tile_Manager.Cover_Kind.CanNot || _Tile.TileMap[x - 1][y] == Tile_Manager.Cover_Kind.Default))
                {
                    Partner.x = x - 1;
                    Partner.y = y;
                    Partner.transform.SetParent(_Tile.MY_Tile[x - 1][y].transform);
                    Partner.T = Partner.transform.parent.GetComponent <Tile>();
                    check     = true;
                }
                break;

            case 1:
                if (x + 1 < _Tile.X && (_Tile.TileMap[x + 1][y] == Tile_Manager.Cover_Kind.CanNot || _Tile.TileMap[x + 1][y] == Tile_Manager.Cover_Kind.Default))
                {
                    Partner.x = x + 1;
                    Partner.y = y;
                    Partner.transform.SetParent(_Tile.MY_Tile[x + 1][y].transform);
                    Partner.T = Partner.transform.parent.GetComponent <Tile>();
                    check     = true;
                }
                break;

            case 2:
                if (y - 1 >= 0 && (_Tile.TileMap[x][y - 1] == Tile_Manager.Cover_Kind.CanNot || _Tile.TileMap[x][y - 1] == Tile_Manager.Cover_Kind.Default))
                {
                    Partner.x = x;
                    Partner.y = y - 1;
                    Partner.transform.SetParent(_Tile.MY_Tile[x][y - 1].transform);
                    Partner.T = Partner.transform.parent.GetComponent <Tile>();
                    check     = true;
                }
                break;

            case 3:
                if (y + 1 < _Tile.Y && (_Tile.TileMap[x][y + 1] == Tile_Manager.Cover_Kind.CanNot || _Tile.TileMap[x][y + 1] == Tile_Manager.Cover_Kind.Default))
                {
                    Partner.x = x;
                    Partner.y = y + 1;
                    Partner.transform.SetParent(_Tile.MY_Tile[x][y + 1].transform);
                    Partner.T = Partner.transform.parent.GetComponent <Tile>();
                    check     = true;
                }
                break;
            }

            r++;
            if (r >= 4)
            {
                r = 0;
            }
        }

        Partner.transform.localPosition = Vector2.zero;
    }
示例#23
0
    public override bool Rand(Unit_Manager _Unit)
    {
        base.Rand(_Unit);

        if (Bullet >= 3 && Unit.Now_Action_Point >= 5)
        {
            switch (Random.Range(1, 4))
            {
            case 1:
                BTN1();
                break;

            case 2:
                BTN2();
                break;

            case 3:
                BTN3();
                break;
            }
        }
        else if (Bullet > 0 && Unit.Now_Action_Point >= 3)
        {
            switch (Random.Range(1, 3))
            {
            case 1:
                BTN1();
                break;

            case 2:
                BTN3();
                break;
            }
        }
        else if (Unit.Now_Action_Point >= 3)
        {
            BTN4();
        }
        else
        {
            return(false);
        }

        if (Btn1 || Btn2 || Btn3)
        {
            if (Mathf.Abs(_Unit.x - Unit.x) - Mathf.Abs(_Unit.y - Unit.y) <= Range)
            {
                if (Btn1)
                {
                    _Unit.Hit(this);
                    Bullet--;
                    _UI._Clip.text = Bullet.ToString();
                    Aim_Bonus      = 0;
                }
                else if (Btn2)
                {
                    StartCoroutine(_BTN2(_Unit));
                }
                else
                {
                    _Unit.Hit(this);
                    Bullet--;
                    _UI._Clip.text = Bullet.ToString();
                    Aim_Bonus      = 0;
                }

                if (Btn2)
                {
                    Unit.Now_Action_Point -= 2;
                }
                Unit.Now_Action_Point -= 3;


                Action = false;
                Btn1   = false;
                Btn3   = false;
            }
            else
            {
                Unit.Now_Action_Point = 0;
            }
        }
        return(true);
    }