Ejemplo n.º 1
0
        protected virtual bool CheckTransferConditions(LBAction _other, LBActionTransitTypes _transit, LBActionTransitDirection _dir)         // нужно добавить проверку на наличие связи?
        {
//			if (_dir == LBActionTransitDirection.In)
//				return base.CanActivateAction (true);
//			else
//				return base.CanDeactivateAction(true);

            return(true);            //no conditions in this class
        }
Ejemplo n.º 2
0
        protected virtual bool TransferAction(LBAction _other, LBActionTransitTypes _transit, LBActionTransitDirection _dir)
        {
            if (_dir == LBActionTransitDirection.In)             // transition from _other to this (IN this)
            {
                if (!this.CanTransferAction(_other, _transit, LBActionTransitDirection.In))
                {
                    return(false);
                }

                if (_other is LBTransitiveAction)
                {
                    LBTransitiveAction other = (LBTransitiveAction)_other;

                    if (other.CanTransferAction(this, _transit, LBActionTransitDirection.Out))
                    {
                        other.Deactivate(this, _transit);
                        this.Activate(other, _transit);

                        return(true);
                    }
                }
                else
                {
                    if (_other.CanDeactivateAction())                      // here we are deactivating with an external call
                    {
                        _other.DeactivateAction();
                        this.Activate(_other, _transit);

                        return(true);
                    }
                }
            }
            else             // transition from this to _other (OUT of this)
            {
                if (!this.CanTransferAction(_other, _transit, LBActionTransitDirection.Out))
                {
                    return(false);
                }

                if (_other is LBTransitiveAction)
                {
                    LBTransitiveAction other = (LBTransitiveAction)_other;

                    if (other.CanTransferAction(this, _transit, LBActionTransitDirection.In))
                    {
                        other.Activate(this, _transit);
                        this.Deactivate(other, _transit);

                        return(true);
                    }
                }
                else
                {
                    if (_other.CanActivateAction())                      // here we are activating with an external call
                    {
                        _other.ActivateAction();
                        this.Deactivate(_other, _transit);

                        return(true);
                    }
                }
            }

            return(false);
        }
Ejemplo n.º 3
0
        protected virtual bool TransferMultiAction(LBAction[] _others, LBActionTransitTypes _transit, LBActionTransitDirection _dir)
        {
            int  i;
            bool b;

            b = false;

            if (_dir == LBActionTransitDirection.In)             // transition from _other to this (IN this)
            {
                for (i = 0; i < _others.Length; i++)
                {
                    if (!this.CanTransferAction(_others [i], _transit, LBActionTransitDirection.In))
                    {
                        return(false);
                    }

                    if (_others [i] is LBTransitiveAction)
                    {
                        LBTransitiveAction other = (LBTransitiveAction)(_others [i]);

                        if (other.CanTransferAction(this, _transit, LBActionTransitDirection.Out))
                        {
                            other.Deactivate(this, _transit);
                            //this.Activate (other, _transit);
                            b = true;

                            //return true;
                        }
                    }
                    else
                    {
                        if (_others [i].CanDeactivateAction())                          // here we are deactivating with an external call
                        {
                            _others [i].DeactivateAction();
                            ///this.Activate (_others[i], _transit);
                            b = true;

                            //return true;
                        }
                    }
                }

                if (b == true)
                {
                    this.Activate(_others, _transit);
                    return(true);
                }
            }
            else             // transition from this to _other (OUT of this)
            {
                for (i = 0; i < _others.Length; i++)
                {
                    if (!this.CanTransferAction(_others [i], _transit, LBActionTransitDirection.Out))
                    {
                        return(false);
                    }

                    if (_others [i] is LBTransitiveAction)
                    {
                        LBTransitiveAction other = (LBTransitiveAction)(_others [i]);

                        if (other.CanTransferAction(this, _transit, LBActionTransitDirection.In))
                        {
                            other.Activate(this, _transit);
                            //this.Deactivate (other, _transit);
                            b = true;

                            //return true;
                        }
                    }
                    else
                    {
                        if (_others [i].CanActivateAction())                          // here we are activating with an external call
                        {
                            _others [i].ActivateAction();
                            //this.Deactivate (_other, _transit);
                            b = true;

                            //return true;
                        }
                    }
                }

                if (b == true)
                {
                    this.Deactivate(_others, _transit);
                    return(true);
                }
            }

            return(false);
        }
        protected override bool CheckTransferConditions(LBAction _other, LBActionTransitTypes _transit, LBActionTransitDirection _dir)         // нужно добавить проверку на наличие связи?
        {
            if (_dir == LBActionTransitDirection.In)
            {
                return(true);
            }
            else
            {
                if (CheckTransferOutCondition(_other))
                {
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 5
0
        protected virtual bool CanTransferAction(LBAction _other, LBActionTransitTypes _transit, LBActionTransitDirection _dir)
        {
            if (_dir == LBActionTransitDirection.In)
            {
                if (!base.CanActivateAction(true))                  // if we cannot activate
                {
                    return(false);
                }
            }
            else
            {
                if (!base.CanDeactivateAction(true))                  // if we cannot deactivate
                {
                    return(false);
                }
            }

            if (_dir == LBActionTransitDirection.In)        // trying to transit from _other to this (IN this)
            {
                if (!HasInputConn(_other))                  // if we don't have this action connected (doesn't matter switch or interrupt)
                {
                    return(false);
                }

                if (this.IsConditionalActivation)                 // if we need to check some conditions to activate
                {
                    if (!this.CheckTransferConditions(_other, _transit, _dir))
                    {
                        return(false);
                    }
                }

                if (_other is LBTransitiveAction)
                {
                    LBTransitiveAction other = (LBTransitiveAction)_other;

                    if (!other.HasOutputConn(this))                      // if _other action is not connected to this
                    {
                        return(false);
                    }

                    if (other.ActionState == LBActionStates.Inactive || other.ActionState == LBActionStates.Disabled)
                    {
                        return(false);
                    }

                    if (other.IsConditionalDeactivation && other.CheckTransferConditions(this, _transit, LBActionTransitDirection.Out) || !other.IsConditionalDeactivation)
                    {
                        return(true);
                    }
                }
                else
                {
                    if (_other.CanDeactivateAction())
                    {
                        return(true);
                    }
                }
            }
            else                                    // trying to transit from this to _other (OUT of this)
            {
                if (this.IsConditionalDeactivation) // if we need to check some conditions to deactvate
                {
                    if (!this.CheckTransferConditions(_other, _transit, _dir))
                    {
                        return(false);
                    }
                }

                if (_other is LBTransitiveAction)
                {
                    LBTransitiveAction other = (LBTransitiveAction)_other;

                    if (!other.HasInputConn(this))                      // if _other action is not connected to this
                    {
                        return(false);
                    }

                    if (_transit == LBActionTransitTypes.Switch && !HasOutputConn(_other))
                    {
                        return(false);
                    }

                    if (other.IsConditionalActivation && other.CheckTransferConditions(this, _transit, LBActionTransitDirection.In) || !other.IsConditionalActivation)
                    {
                        return(true);
                    }
                }
                else
                {
                    if (_transit == LBActionTransitTypes.Switch)
                    {
                        if (!CanSwitch(_other))
                        {
                            return(false);
                        }

                        if (_other.CanActivateAction())
                        {
                            return(true);
                        }
                    }
                }
            }

            return(false);
        }
Ejemplo n.º 6
0
 protected override bool CheckTransferConditions(LBAction _other, LBActionTransitTypes _transit, LBActionTransitDirection _dir)         // нужно добавить проверку на наличие связи?
 {
     if (_dir == LBActionTransitDirection.In)
     {
         return(bIsWeightless());
         //return true; //!bHasWalkableFloor ();
     }
     else
     {
         return(true);
     }
 }
 protected override bool CheckTransferConditions(LBAction _other, LBActionTransitTypes _transit, LBActionTransitDirection _dir)         // нужно добавить проверку на наличие связи?
 {
     if (_dir == LBActionTransitDirection.In)
     {
         return(bHasWalkableFloor() && bHasPropperSpeed());
     }
     else
     {
         return(true);
     }
 }
 protected override bool CheckTransferConditions(LBAction _other, LBActionTransitTypes _transit, LBActionTransitDirection _dir)
 {
     if (_dir == LBActionTransitDirection.In)
     {
         return(base.CheckTransferConditions(_other, _transit, LBActionTransitDirection.In) && bHasWalkableFloor() && bHasImpulse);
     }
     else
     {
         return(base.CheckTransferConditions(_other, _transit, LBActionTransitDirection.Out));
     }
 }
//		protected override void ActivateAnimation()
//		{
//
//			if (AnimationTrasnitionType == LBAnimationTransitionTypes.Play)
//			{
//				PlayAnimation(AnimationName, AnimationLayer, 0);
//			}
//			else
//			{
//				CrossfadeAnimation(AnimationName, AnimationLayer, AnimationBlendTime);
//			}
//		}

        protected override bool CheckTransferConditions(LBAction _other, LBActionTransitTypes _transit, LBActionTransitDirection _dir)
        {
            if (_dir == LBActionTransitDirection.In)
            {
                if (bCanTurnInPlace())
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                if (!bCanTurnInPlace())
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Ejemplo n.º 10
0
 protected override bool CheckTransferConditions(LBAction _other, LBActionTransitTypes _transit, LBActionTransitDirection _dir)         // нужно добавить проверку на наличие связи?
 {
     if (_dir == LBActionTransitDirection.In)
     {
         return(base.CheckTransferConditions(_other, _transit, LBActionTransitDirection.In) && bCanLand());
     }
     else
     {
         return(base.CheckTransferConditions(_other, _transit, LBActionTransitDirection.Out));
     }
 }
Ejemplo n.º 11
0
        // for a generic action -- always true
        protected override bool CheckTransferConditions(LBAction _other, LBActionTransitTypes _transit, LBActionTransitDirection _dir)         // нужно добавить проверку на наличие связи?
        {
            if (_dir == LBActionTransitDirection.In)
            {
                return(true);
            }
            else
            {
                if (ActionPerfomacneType == LBActionPerformanceTypes.PerformOnceModal && AnimationExtraLoops >= 1 || AnimationName == string.Empty)
                {
                    return(true);
                }
                else if (ActionPerfomacneType == LBActionPerformanceTypes.PerformOnce)
                {
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 12
0
 protected override bool CheckTransferConditions(LBAction _other, LBActionTransitTypes _transit, LBActionTransitDirection _dir)         // нужно добавить проверку на наличие связи?
 {
     if (_dir == LBActionTransitDirection.In)
     {
         if (bCanWalk())
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(base.CheckTransferConditions(_other, _transit, _dir) || bCanStopWalk());
     }
 }