// Use this for initialization void Start() { _reverter = new GameObjectReverter (this.gameObject); _bounder = new Bounder (bounds); Behavior p1Up = new MovementCallbackBehavior("player1 move up", this.gameObject, new Vector3( 0, 1, 0) * speed, Move); Behavior p1Down = new MovementCallbackBehavior("player1 move down", this.gameObject, new Vector3( 0, -1, 0) * speed, Move); Behavior p1Left = new MovementCallbackBehavior("player1 move left", this.gameObject, new Vector3(-1, 0, 0) * speed, Move); Behavior p1Right = new MovementCallbackBehavior("player1 move right", this.gameObject, new Vector3( 1, 0, 0) * speed, Move); // create the control scheme that maps inputs to these behaviors SetControlScheme(0, p1Up, p1Down, p1Left, p1Right); Reset(); }
void Start() { _reverter = new GameObjectReverter(this.gameObject); _random = new RandomReverter(); _bounder = new Bounder(bounds); Behavior p2Wind = new DynamicWindBehavior("player2 wind", this.gameObject, WindChanged); Behavior p2Up = new MovementCallbackBehavior("player2 move up", this.gameObject, new Vector3( 0, 0, -1) * speed * Time.fixedDeltaTime, Move); Behavior p2Down = new MovementCallbackBehavior("player2 move down", this.gameObject, new Vector3( 0, 0, 1) * speed * Time.fixedDeltaTime, Move); Behavior p2Left = new MovementCallbackBehavior("player2 move left", this.gameObject, new Vector3( 1, 0, 0) * speed * Time.fixedDeltaTime, Move); Behavior p2Right = new MovementCallbackBehavior("player2 move right", this.gameObject, new Vector3(-1, 0, 0) * speed * Time.fixedDeltaTime, Move); // rig control scheme mControls.AddControl(new TrueSignal(), p2Wind ); // for buttons SetControlScheme(1, p2Up, p2Down, p2Left, p2Right); Reset(); }