public override void Actuate(IActivator activator, Dictionary <object, object> argumentDictionary = null) { CirclePhysicsBody circlePhysicsBody = (CirclePhysicsBody)activator; bool D = (bool)argumentDictionary['D']; bool A = (bool)argumentDictionary['A']; bool W = (bool)argumentDictionary['W']; bool S = (bool)argumentDictionary['S']; Vector2 impulseVector = circlePhysicsBody.dashImpulse * PlayerCompleteBodyController.GetUnitVector(D, A, W, S); circlePhysicsBody.GetComponent <Rigidbody2D>().AddForce(impulseVector, ForceMode2D.Impulse); }
/** * Moves up for W, down for S, right for D, and left for A. * Diagonal movement for orthogonal combinations of WASD. */ public virtual void MoveWASD(bool D, bool A, bool W, bool S, bool crawl = false) { if ((int)activator.GetHealthState() >= (int)HealthState.Fibrillating) { crawl = crawl || (int)activator.GetHealthState() == (int)HealthState.Fibrillating; Vector2 unitVector = PlayerCompleteBodyController.GetUnitVector(D, A, W, S); float force = crawl ? crawlForce : moveForce; Vector2 forceVector = force * unitVector; //if (relative) { // different control scheme // rb2D.AddRelativeForce(forceVector); //} else { rb2D.AddForce(forceVector); //} } }