public InputTarget(Character character, Cell cell) { if (character != null || cell != null) { isOverHUD = false; this.character = character; this.cell = cell; } else isOverHUD = true; }
public InputTarget(Character character) : this(character, character.GetCell()) { }
protected virtual void Awake() { _owner = GetComponentInParent<Character>(); _collider = GetComponent<Collider>(); _obstacle = GetComponent<DynamicObstacle>(); }
/// <summary> /// Initializes the Unit Facade. /// </summary> /// <param name="unitObject">The unit game object.</param> public virtual void Initialize(GameObject unitObject) { _props = unitObject.As<IUnitProperties>(false, true); _movable = unitObject.As<IMovable>(false, false); _moving = unitObject.As<IMovingObject>(false, true); _speeder = unitObject.As<IDefineSpeed>(false, true); _pathFinderOptions = unitObject.As<IPathFinderOptions>(false, false) ?? new PathFinderOptions(); _pathNavOptions = unitObject.As<IPathNavigationOptions>(false, false) ?? new PathNavigationOptions(); _character = unitObject.As<Character>(true, true); this.isMovable = _movable != null; if (!this.isMovable) { _movable = new MovableDummy(unitObject.name); } this.gameObject = unitObject; this.transform = unitObject.transform; this.collider = unitObject.GetComponent<Collider>(); this.isAlive = true; this.hasArrivedAtDestination = true; }
private Action TaskToAction(Task task, Character character) { Action action = null; if (task.Type == Task.TaskType.Move) { var isNormalMoving = MovingOffset.Instance.AllNormalDistanceCells.Contains(task.Cell); var fistMove = character.CurrentActionPoints >= character.MaxActionPoints; int price = 0; if (fistMove) { price = isNormalMoving ? 5 : 10; if (isNormalMoving) action = new NormalMoveAction(character, new ActionPrice() {points = price}, task.Cell); else action = new SprintMoveAction(character, new ActionPrice() {points = price}, task.Cell); } else { price = character.CurrentActionPoints; action = new NormalMoveAction(character, new ActionPrice() { points = price }, task.Cell); } } return action; }
private void CurrentCharacterOnJobIsDone(Character character) { CurrentControlled.JobIsDone -= CurrentCharacterOnJobIsDone; SelectNextCharacter(); }
private void CurrentCharacterOnActionFinished(Character character, Action action, bool finished) { character.ActionFinished -= CurrentCharacterOnActionFinished; // Debug.Log(string.Format("{0} is {1} action {2}",character.name, (finished?"finished":"failed"), action.name)); character.OccupyCurrentCell(true); }