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); } } }
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(); }
public void OnFigureRemoved(Figure figure) { figures.Remove(figure.GetInstanceID()); }
public void OnFigureCreated(Figure figure) { figures[figure.GetInstanceID()] = figure; }
public virtual void Contact(Figure figure) { Item.Contact(figure); }
protected override bool OnContact(Figure figure) { float damage = Owner.IsEnemy(figure.Owner) ? Damage : 0; figure.OnAttack(this, damage); return true; }
protected abstract void OnFigureCollided(Figure figure, int bounceHeight, bool forced);
public static void SetTarget(Figure target) { instance.gameObject.SetActive(true); instance.target = target; }
protected override bool OnContact(Figure figure) { figure.AddElement(this); return true; }
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)); } }
protected abstract bool OnContact(Figure figure);
public void Contact(Figure figure) { if (OnContact(figure)) box.Destroy(); }