Exemplo n.º 1
0
 public Phase(PhaseId id, string description, object context, IEnumerable <GameAction> possibleActions)
 {
     Id              = id;
     Description     = description;
     Context         = context;
     PossibleActions = possibleActions;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                var hashCode = 41;
                // Suitable nullity checks etc, of course :)
                if (Id != null)
                {
                    hashCode = hashCode * 59 + Id.GetHashCode();
                }
                if (StepId != null)
                {
                    hashCode = hashCode * 59 + StepId.GetHashCode();
                }
                if (PhaseId != null)
                {
                    hashCode = hashCode * 59 + PhaseId.GetHashCode();
                }
                if (Action != null)
                {
                    hashCode = hashCode * 59 + Action.GetHashCode();
                }
                if (Repository != null)
                {
                    hashCode = hashCode * 59 + Repository.GetHashCode();
                }
                if (Branch != null)
                {
                    hashCode = hashCode * 59 + Branch.GetHashCode();
                }
                if (Environment != null)
                {
                    hashCode = hashCode * 59 + Environment.GetHashCode();
                }
                if (EnvironmentType != null)
                {
                    hashCode = hashCode * 59 + EnvironmentType.GetHashCode();
                }
                if (StartedAt != null)
                {
                    hashCode = hashCode * 59 + StartedAt.GetHashCode();
                }
                if (FinishedAt != null)
                {
                    hashCode = hashCode * 59 + FinishedAt.GetHashCode();
                }
                if (Details != null)
                {
                    hashCode = hashCode * 59 + Details.GetHashCode();
                }

                hashCode = hashCode * 59 + Status.GetHashCode();
                if (Links != null)
                {
                    hashCode = hashCode * 59 + Links.GetHashCode();
                }
                return(hashCode);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Check current phase/state and card's position and perform mouse drag.
        /// </summary>
        private void CardClick(PhaseId logic, CreatureCard c)
        {
            CardLogic cardLogic   = new CardLogic();
            bool      isMouseDown = Input.GetMouseButtonDown(0);

            if (!isMouseDown)
            {
                if (c != null)
                {
                    cardLogic.SetToAttack(c);
                    //TODO: Check current state / phase and perform action
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Drop Creature Card On Field.
        /// Navigate Card Instance to appropriate logics.
        /// </summary>
        /// <param name="logic"></param>
        /// <param name="target"></param>
        private bool DropAfterDrag(PhaseId logic, Card target)
        {
            SpellCard       spell           = null;
            CreatureCard    creature        = null;
            CardLogic       cardLogic       = new CardLogic();
            CardSyncManager cardPlayManager = CardSyncManager.singleton;
            bool            ret             = false;

            if (target is SpellCard)
            {
                spell = (SpellCard)target;
            }
            else if (target is CreatureCard)
            {
                creature = (CreatureCard)target;
            }

            if (logic == PhaseId.Control)
            {
                if (spell)
                {
                    cardLogic.UseSpell(spell);
                }
                else if (creature)
                {
                    ret = cardLogic.DropCard(creature);
                    if (ret)
                    {
                        Area a = target.PhysicalCondition.GetOriginFieldLocation().GetComponent <Area>();
                        cardPlayManager.CardPlayDrop(creature, a);
                    }
                }
            }
            else if (logic == PhaseId.Block)
            {
                ret = cardLogic.BlockCard(creature);
                if (ret)
                {
                    CreatureCard atkCard = cardLogic.GetAttackingCard;
                    cardPlayManager.CardPlayBlock(creature, atkCard);
                }
            }

            return(ret);
        }
Exemplo n.º 5
0
 public override int GetHashCode()
 {
     return(PhaseId.GetHashCode());
 }
Exemplo n.º 6
0
 public Phase(PhaseId id, int durationInMinutes)
 {
     Id = id;
 }
Exemplo n.º 7
0
        /// <summary>
        /// Returns true if PipelineExecutionStepState instances are equal
        /// </summary>
        /// <param name="other">Instance of PipelineExecutionStepState to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(PipelineExecutionStepState other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     StepId == other.StepId ||
                     StepId != null &&
                     StepId.Equals(other.StepId)
                 ) &&
                 (
                     PhaseId == other.PhaseId ||
                     PhaseId != null &&
                     PhaseId.Equals(other.PhaseId)
                 ) &&
                 (
                     Action == other.Action ||
                     Action != null &&
                     Action.Equals(other.Action)
                 ) &&
                 (
                     Repository == other.Repository ||
                     Repository != null &&
                     Repository.Equals(other.Repository)
                 ) &&
                 (
                     Branch == other.Branch ||
                     Branch != null &&
                     Branch.Equals(other.Branch)
                 ) &&
                 (
                     Environment == other.Environment ||
                     Environment != null &&
                     Environment.Equals(other.Environment)
                 ) &&
                 (
                     EnvironmentType == other.EnvironmentType ||
                     EnvironmentType != null &&
                     EnvironmentType.Equals(other.EnvironmentType)
                 ) &&
                 (
                     StartedAt == other.StartedAt ||
                     StartedAt != null &&
                     StartedAt.Equals(other.StartedAt)
                 ) &&
                 (
                     FinishedAt == other.FinishedAt ||
                     FinishedAt != null &&
                     FinishedAt.Equals(other.FinishedAt)
                 ) &&
                 (
                     Details == other.Details ||
                     Details != null &&
                     other.Details != null &&
                     Details.SequenceEqual(other.Details)
                 ) &&
                 (
                     Status == other.Status ||

                     Status.Equals(other.Status)
                 ) &&
                 (
                     Links == other.Links ||
                     Links != null &&
                     Links.Equals(other.Links)
                 ));
        }