Exemplo n.º 1
0
 public InputTarget(Character character, Cell cell)
 {
     if (character != null || cell != null)
     {
         isOverHUD = false;
         this.character = character;
         this.cell = cell;
     }
     else
         isOverHUD = true;
 }
Exemplo n.º 2
0
 public InputTarget(Character character)
     : this(character, character.GetCell())
 {
 }
Exemplo n.º 3
0
 protected virtual void Awake()
 {
     _owner = GetComponentInParent<Character>();
     _collider = GetComponent<Collider>();
     _obstacle = GetComponent<DynamicObstacle>();
 }
Exemplo n.º 4
0
        /// <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;
        }
Exemplo n.º 5
0
        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;
        }
Exemplo n.º 6
0
 private void CurrentCharacterOnJobIsDone(Character character)
 {
     CurrentControlled.JobIsDone -= CurrentCharacterOnJobIsDone;
     SelectNextCharacter();
 }
Exemplo n.º 7
0
 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);
 }