Beispiel #1
0
        /// <summary>
        /// Set or Swap caravan member with active slot.
        /// </summary>
        /// <param name="target"></param>
        /// <returns></returns>
        public (ActorBase prevActive, ActorBase curActive) SetActiveMember(CaravanMember target)
        {
            // Cleanup
            caravan.Remove(target.actor);
            if (activeCaravanActor != null)
            {
                caravan.Add(activeCaravanActor);
            }

            // Swap
            var temp         = activeCaravanActor;
            var activeMember = activeCaravanSpawn.GetComponent <CaravanMember>();

            activeMember.SetCaravanMember(target.actor);
            activeCaravanActor = target.actor;
            target.SetCaravanMember(temp);
            activeCaravanSpawn.SetActive(activeCaravanActor != null);
            return(temp, activeCaravanActor);
        }
Beispiel #2
0
        public void SwapWithActive(CaravanMember target)
        {
            if (turnState != TurnState.PlayerAct || !handManager.swapAvailable)
            {
                return;
            }

            handManager.remainingActions--;
            handManager.swapAvailable = false;

            var(prev, cur) = caravanManager.SetActiveMember(target);
            if (prev != null)
            {
                prev.animations.EnterRight();
                ProcessEffectsAndLog(prev.OnExit, prev);
            }
            cur.animations.EnterLeft();
            ProcessEffectsAndLog(cur.OnEnter, cur);

            if (handManager.remainingActions == 0)
            {
                OnPlayerActFinish();
            }
        }