protected override void Activate(LBAction _prev, LBActionTransitTypes _transit)
        {
            base.Activate(_prev, _transit);

            TargetDir     = MovementDir;         // We should remember this value, because MovementDir may change
            bCanSetNewDir = false;
        }
//		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);
                }
            }
        }
        protected override void Activate(LBAction _prev, LBActionTransitTypes _transit)
        {
            base.Activate(_prev, _transit);

            if (bPreserveFlatSpeed)
            {
                origvel = new Vector3(RBSpeedVector.x, 0, RBSpeedVector.z);
            }
        }
Exemplo n.º 4
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
        }
 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 bool CheckTransferConditions(LBAction _other, LBActionTransitTypes _transit, LBActionTransitDirection _dir)         // нужно добавить проверку на наличие связи?
 {
     if (_dir == LBActionTransitDirection.In)
     {
         return(bHasRBBase());
     }
     else
     {
         return(true);
     }
 }
Exemplo n.º 8
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));
     }
 }
Exemplo n.º 9
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 void Activate(LBAction _prev, LBActionTransitTypes _transit)
        {
            base.Activate(_prev, _transit);

//			Vector3 v = RBSpeedVector;
//
//			v.y = JumpInstantUpSpeed;
//
//			rigidbody.velocity = v;
            lastrbvel            = RBSpeedVector;
            jumpheight           = 0;
            bUseGravity          = rigidbody.useGravity;
            rigidbody.useGravity = false;
            bhasrestoredvel      = false;
        }
Exemplo n.º 11
0
        protected override void Activate(LBAction _prev, LBActionTransitTypes _transit)
        {
            base.Activate(_prev, _transit);

            if (bPreserveSpeed)
            {
//				MovementSpeed = RBFlatSpeed;
                MovementDir   = RBFlatSpeedDir;
                idealvelocity = new Vector3(RBSpeedVector.x, 0, RBSpeedVector.z);

                if (bAutoDetectInputSpeed)
                {
                    base.SetMovementSpeed(idealvelocity.magnitude / BaseMovementSpeed);
                }
            }
        }
//		protected override bool TransferAction (LBAction _other, LBActionTransitTypes _transit, LBActionTransitDirection _dir) // гемор?!
//		{
//			if (_dir == LBActionTransitDirection.Out)
//				bHasImpulse = false;
//
//			return base.TransferAction (_other, _transit, _dir);
//		}

        protected override void Activate(LBAction _prev, LBActionTransitTypes _transit)
        {
            //LBCharacterMovementAction mov;
            base.Activate(_prev, _transit);

//			mov = (LBCharacterMovementAction)_prev;
//
//			if (mov != null)
//			{
//				SetMovementSpeed (RBSpeed);
//				SetMovementDir (RBSpeedDir);
//			}

            if (bPreserveSpeed)
            {
                origvel = RBSpeedVector;
            }
        }
Exemplo n.º 13
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());
     }
 }
Exemplo n.º 14
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);
        }
        protected override void Activate(LBAction _prev, LBActionTransitTypes _transit)
        {
            base.Activate(_prev, _transit);

            _oldrot = rigidbody.rotation;
        }
Exemplo n.º 16
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);
        }
Exemplo n.º 17
0
 public LBActionTransitionEventArgs(LBAction _old_action, LBAction _new_action, LBActionTransitTypes _transit_type)
 {
     old_action   = _old_action;
     new_action   = _new_action;
     transit_type = _transit_type;
 }
Exemplo n.º 18
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);
        }
Exemplo n.º 19
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);
        }
Exemplo n.º 20
0
 protected virtual void Deactivate(LBAction[] _nexts, LBActionTransitTypes _transit)
 {
     base.Deactivate();
 }
Exemplo n.º 21
0
 protected virtual void Activate(LBAction[] _prevs, LBActionTransitTypes _transit)
 {
     base.Activate();
 }
 protected override void Deactivate(LBAction _next, LBActionTransitTypes _transit)
 {
     base.Deactivate(_next, _transit);
     bCanSetNewDir = true;
 }
Exemplo n.º 23
0
        protected override void Activate(LBAction _prev, LBActionTransitTypes _transit)
        {
            base.Activate(_prev, _transit);

            ActivateAnimation();
        }
        protected override void Deactivate(LBAction _next, LBActionTransitTypes _transit)
        {
            base.Deactivate();

            RestoreOrigVel();
        }