Exemplo n.º 1
0
 public DefaultBehavioursRigidbody(MovementPipeline <Rigidbody, C> pipeline)
 {
     TargetPipeline = pipeline;
     _mappingDict   = new Dictionary <RigibodyBehaviours, MovementBehaviour <Rigidbody> >();
     _mappingDict.Add(RigibodyBehaviours.ChangeVelocity, ChangeVelocity);
     _mappingDict.Add(RigibodyBehaviours.ClampVelocity, ClampVelocity);
 }
Exemplo n.º 2
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;
    }
Exemplo n.º 3
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);
 }