Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- namespace Heroes
- {
- public class Army : IEntitable, IHoldable/*, IActivist*/
- {
- public int factionID; //тестовое!
- public Entitum EntitumHolded { get; }
- public Holder HoldedHolder { get; set; }
- public Activion HoldedActivion { get; set; }
- public Army(Entitum entitum)
- {
- EntitumHolded = entitum;
- Vector2Int cellIndexOfThis = Doinger.PositionToCellIndex(entitum.transform.position);
- Cell cellOurs = Main.cellsKeeper.CellsCollection[cellIndexOfThis.x, cellIndexOfThis.y];
- Vector2Int[] cellsByOffsetFromZero = new Vector2Int[] { new Vector2Int(0, 0) };
- HoldedHolder = new Holder(cellOurs, cellsByOffsetFromZero, this, this);
- HoldedActivion = new Activion(10, 10);
- }
- public void LMB(ContextControl context)
- {
- if (context.IsMarkedEqual(this))
- {
- ShowArmyUI();
- }
- else /*if (contextuum.marked == another) and default and contextuum.marked == null*/
- {
- context.SetMarked(this);
- Debug.Log(this);
- }
- }
- public void MMB(ContextControl context)
- {
- Debug.Log("Колёсико");
- }
- public void RMB(ContextControl context)
- {
- if (context.IsMarkedEqual(this))
- {
- ShowArmyUI();
- }
- }
- public bool ResponseParamEntityToCaller(IEntitable sourceLikeMarked, ContextControl context)
- {
- return sourceLikeMarked.ReactWithByCallback(this, context); //арми.респонс(лес) - лес.реактКолбек(арми)
- }
- public bool ReactWithByCallback(Army army, ContextControl context)
- {
- CheckAndBattle(this, army); //this это выделенный, т.е. мы, а арми это рейкастнутый
- return false;
- }
- public bool ReactWithByCallback(Place place, ContextControl context)
- {
- Debug.Log("Дошли до Места!");
- HoldedActivion.CurrentPoints -= 1;
- return false;
- }
- public bool ReactWithByCallback(Fascia fascia, ContextControl context)
- {
- //Debug.Log("Дошли до Фасции!");
- //Main.notifyUI.AddNotice(2f, HoldedActivion.CurrentPoints.ToString() );
- if (HoldedActivion.CurrentPoints >= 5)
- {
- Main.notifyUI.AddNotice(2f, $"Walk across fascia!");
- HoldedActivion.CurrentPoints -= 5;
- return fascia.IsMovable;
- }
- else
- {
- Main.notifyUI.AddNotice(2f, $"Not enought points!");
- return false;
- }
- }
- public bool ReactWithByCallback(Unit unit, ContextControl context)
- {
- return false;
- }
- public bool ReactWithByCallback(Landscape landscape, ContextControl context)
- {
- Movement.Move(this.EntitumHolded/*.transform*/, context.hitStored); //но непонятно, зачем тогда Энтитум в ландшафте пока, если используем только у армии
- return true;
- }
- private void ShowArmyUI()
- {
- Debug.Log("ЮИ Армии показываем");
- }
- private void CheckAndBattle(Army first, Army second)
- {
- if (first.factionID != second.factionID)
- {
- //что-то вроде context.GoToFight(first, second)
- }
- else
- {
- Debug.Log("Это свои!");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment