예제 #1
0
    private void Start()
    {
        startPosition = transform.position;
        mover         = GetComponent <Mover2D>();

        Speed = mover.CurrentSpeed;

        time = (TargetPosition - startPosition).magnitude / Speed;
    }
예제 #2
0
    public void Execute(GameObject actor)
    {
        Mover2D actorMover = actor.GetComponent <Mover2D>();

        if (actorMover != null)
        {
            actorMover.Move(moveDirection);
        }
        else
        {
            Debug.LogError("INVALID COMMAND called on " + actor.name + ", no Mover component found");
        }
    }
예제 #3
0
    public void Execute(GameObject actor)
    {
        Mover2D actorMover = actor.GetComponent <Mover2D>();

        if (actorMover != null)
        {
            actorMover.SnapLookAt(lookPoint);
        }
        else
        {
            Debug.LogError("IVALID COMMAND called on " + actor.name + ", no Mover component found");
        }
    }
예제 #4
0
    private void Start()
    {
        mover      = GetComponent <Mover2D>();
        collider2d = GetComponent <CircleCollider2D>();
        producer   = GetComponent <AgentProducer>();

        sr            = GetComponent <SpriteRenderer>();
        defaultSprite = sr.sprite;
        defaultScale  = transform.localScale;
        defaultColor  = sr.color;

        // Assert.IsTrue(Live || (Dead && kill) || (Dead && infect));

        // Assert.IsTrue(Live && !kill && !infect);
    }
예제 #5
0
    void Awake()
    {
        current = this;

        mover    = GetComponent <Mover2D>();
        animator = GetComponent <Animator>();

        inputs = new Inputs();
        inputs.Player.Move.performed     += (x) => mover.v2MoveInput.x = x.ReadValue <float>();
        inputs.Player.Jump.performed     += (x) => mover.JumpDown();
        inputs.Player.Jump.canceled      += (x) => mover.JumpUp();
        inputs.Player.Interact.performed += (x) => { if (!Game.current.PAUSED)
                                                     {
                                                         Interact();
                                                     }
        };
    }
예제 #6
0
    public InputPlatformer(Mover2D mover, Rigidbody2D rb,
                           Angle upAngle, float gravityAcceleration,
                           Angle maxSlopeAngle, float groundDeceleration,
                           float maxHorizontalSpeed, float groundAcceleration,
                           string groundInputName, float jumpVelocity,
                           KeyCode buttonJump, float variableJumpDampFactor)
    {
        upDirection = new UpDirection2D(upAngle);
        vius        = new VelocityInUpSpace2D(mover, upDirection);
        gravity     = new Gravity2D(vius, gravityAcceleration);

        groundChecker = new GroundChecker2D(rb, upDirection, maxSlopeAngle);

        gba = new GroundBasedAcceleration2D(groundChecker, vius, groundDeceleration, maxHorizontalSpeed);

        igba = new InputGroundBasedWalk2D(gba, groundAcceleration, groundInputName);

        gbj             = new GroundBasedJump2D(groundChecker, vius);
        igbj            = new InputGroundBasedJump2D(gbj, jumpVelocity, buttonJump);
        variableJumping = new InputVariableJump2D(vius, gravity, variableJumpDampFactor, buttonJump);
        gbj.SubscribeToJumped(x => variableJumping.ResetVariableJump());
    }
예제 #7
0
 public VelocityInUpSpace2D(Mover2D mover, UpDirection2D upDirection)
 {
     this.mover       = mover;
     this.upDirection = upDirection;
 }
예제 #8
0
 public Refs(Mover2D mover)
 {
     this.mover = mover;
 }
예제 #9
0
    void Start()
    {
        target = Player.current.GetComponent <Mover2D>();

        sqAlwaysFollowRange = alwaysFollowRange * alwaysFollowRange;
    }