Пример #1
0
    private void Awake()
    {
        rb = this.GetComponent <Rigidbody>();
        movementPipeline    = new MovementPipeline <Rigidbody, PlayerMovement>(rb, this);
        behavioursRigidbody = new DefaultBehavioursRigidbody <PlayerMovement>(movementPipeline);
        behavioursRigidbody.ComposeBehaviours(RigibodyBehaviours.ChangeVelocity,
                                              RigibodyBehaviours.ClampVelocity);

        maxSpeedChange = maxAcceleration * Time.fixedDeltaTime;
        mainCamera     = Camera.main;
    }
Пример #2
0
 private void Start()
 {
     myTransformReference = transform;
     if (copyOffsetFromPosition)
     {
         offset = myTransformReference.position;
     }
     rb = GetComponent <Rigidbody>();
     movementPipeline    = new MovementPipeline <Rigidbody, FollowTarget>(rb, this);
     behavioursRigidbody = new DefaultBehavioursRigidbody <FollowTarget>(movementPipeline);
     behavioursRigidbody.ComposeBehaviours(RigibodyBehaviours.ChangeVelocity,
                                           RigibodyBehaviours.ClampVelocity);
 }