private void Start() { startPosition = transform.position; mover = GetComponent <Mover2D>(); Speed = mover.CurrentSpeed; time = (TargetPosition - startPosition).magnitude / Speed; }
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"); } }
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"); } }
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); }
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(); } }; }
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()); }
public VelocityInUpSpace2D(Mover2D mover, UpDirection2D upDirection) { this.mover = mover; this.upDirection = upDirection; }
public Refs(Mover2D mover) { this.mover = mover; }
void Start() { target = Player.current.GetComponent <Mover2D>(); sqAlwaysFollowRange = alwaysFollowRange * alwaysFollowRange; }