示例#1
0
        private void Update()
        {
            if (activePlayer == null) return;

            if (Input.GetKeyDown(KeyCode.Z))
            {
                TurnController.OnPlayerFinishedTurn();
            }

            if (Input.GetMouseButtonDown(0))
            {
                var ray = currCamera.ScreenPointToRay(Input.mousePosition);
                RaycastHit hit;
                if (Physics.Raycast(ray, out hit, 1000, 1 << 9))
                {
                    selectedFigure = hit.collider.GetComponent<Figure>();
                    StatsPanel.SetTarget((Figure)selectedFigure);
                }
            }

            //if (Input.GetMouseButtonDown(1))
            //{
            //    var ray = currCamera.ScreenPointToRay(Input.mousePosition);
            //    RaycastHit hit;
            //    if (Physics.Raycast(ray, out hit, 1000, 1 << 8))
            //    {
            //        GameMap.I.ResetFlags(0);
            //        hit.collider.GetComponent<Hex>().PaintNeighbors(Color.green);
            //    }
            //}
            int createBombFlag = 0;

            if (Input.GetKey(KeyCode.B) && selectedFigure && selectedFigure.Active)
            {
                createBombFlag = selectedFigure.bombCurrCD == 0 ? 1 : -1;
            }

            if (Input.GetMouseButtonDown(1) && selectedFigure && selectedFigure.Active && selectedFigure.Owner == activePlayer)
            {
                if (createBombFlag != -1)
                {
                    var ray = currCamera.ScreenPointToRay(Input.mousePosition);
                    RaycastHit hit;

                    if (Physics.Raycast(ray, out hit, 1000, 1 << 8))
                    {
                        var result = selectedFigure.MoveTo(hit.collider.GetComponent<Hex>(), Input.GetKey(KeyCode.Q));
                        if (result == MoveResult.Ok && createBombFlag == 1)
                        {
                            selectedFigure.CreateBomb();
                        }
                    }
                }
                else
                {
                    Instantiate(Resources.Load<BitchController>("Prefabs/Play/Msg")).Initialize(25, 1, 2, 2,
                        "Bomb kaking in CD! Sry Bitch! Wait " + selectedFigure.bombCurrCD + " nah!", Color.red);
                }
            }
        }
示例#2
0
        private void NextTurn()
        {
            pickedFigure = null;

            while (pickedFigure == null && currentFigureIndex + 1 < figures.Count)
            {
                currentFigureIndex++;
                pickedFigure = figures[currentFigureIndex];
            }

            if (pickedFigure == null)
            {
                TurnFinished(true);
                Next(true);
            }
            else
                pickedFigure.Activate();
        }
示例#3
0
 public void OnFigureRemoved(Figure figure)
 {
     figures.Remove(figure.GetInstanceID());
 }
示例#4
0
 public void OnFigureCreated(Figure figure)
 {
     figures[figure.GetInstanceID()] = figure;
 }
示例#5
0
 public virtual void Contact(Figure figure)
 {
     Item.Contact(figure);
 }
示例#6
0
 protected override bool OnContact(Figure figure)
 {
     float damage = Owner.IsEnemy(figure.Owner) ? Damage : 0;
     figure.OnAttack(this, damage);
     return true;
 }
示例#7
0
 protected abstract void OnFigureCollided(Figure figure, int bounceHeight, bool forced);
示例#8
0
 public static void SetTarget(Figure target)
 {
     instance.gameObject.SetActive(true);
     instance.target = target;
 }
示例#9
0
 protected override bool OnContact(Figure figure)
 {
     figure.AddElement(this);
     return true;
 }
示例#10
0
 protected override void OnFigureCollided(Figure figure, int bounceHeight, bool forced)
 {
     if (figure.Owner.IsAlly(Owner))
     {
         if (forced && ap.CurrValue <= 0)
         {
             figure.OnAttack(this, penaltiAllyAttack.Calculate(-bounceHeight));
         }
     }
     else
     {
         figure.OnAttack(this, simpleAttack.Calculate(-bounceHeight));
     }
 }
示例#11
0
文件: Item.cs 项目: Rupini/Hexocracy
 protected abstract bool OnContact(Figure figure);
示例#12
0
文件: Item.cs 项目: Rupini/Hexocracy
 public void Contact(Figure figure)
 {
     if (OnContact(figure)) box.Destroy();
 }