IEnumerator jump(MovementSettings movmentSettings) { rb.AddForce(Vector2.up * movmentSettings.jumpHeight, ForceMode2D.Impulse); yield return(new WaitForSeconds(movmentSettings.hangTime)); rb.AddForce(Vector2.down * movmentSettings.fallSpeed, ForceMode2D.Impulse); }
private void SetupTest(float coyoteTime) { go = new GameObject(); timer = go.AddComponent <CoyoteTimer>(); settings = go.AddComponent <MovementSettings>(); timer.CoyoteTime += () => settings.CoyoteTime; }
/* The Reset () function is called by Unity when you first add a script, and when you choose Reset on the gear popup menu for the script. */ void Reset() { /* * Set some nice default values for our MovementSettings. */// Set some nice default values for our MovementSettings. if (positionalMovement == null) { positionalMovement = new MovementSettings(); } positionalMovement.maxSpeed = 3.0f; positionalMovement.drag = 3.0f; positionalMovement.dragWhileBeyondMaxSpeed = 4.0f; positionalMovement.positiveAcceleration = 50.0f; positionalMovement.negativeAcceleration = 0.0f; // By default, we don't have reverse thrusters. //we push in this direction positionalMovement.forceNormal.x = 0; positionalMovement.forceNormal.y = 1; positionalMovement.forceNormal.z = 0; inputAxisName = "Vertical"; this.specialEffects.positiveThrustEffect = null; this.specialEffects.negativeThrustEffect = null; }
public Projectile(IView view, MovementSettings moveSettings) { Movement = new Movable(moveSettings); this.view = view; this.view.OnUpdate += OnUpdate; }
/* The Reset () function is called by Unity when you first add a script, and when you choose Reset on the gear popup menu for the script. */ void Reset() { // Set some nice default values for our MovementSettings. if (rotationalMovement == null) { rotationalMovement = new MovementSettings(); } rotationalMovement.maxSpeed = 2.0f; rotationalMovement.dragWhileBeyondMaxSpeed = 16.0f; rotationalMovement.drag = 0.1f; rotationalMovement.positiveAcceleration = 50.0f; rotationalMovement.negativeAcceleration = 50.0f; //we turn around this axis rotationalMovement.forceNormal.x = 0; rotationalMovement.forceNormal.y = 0; rotationalMovement.forceNormal.z = -1; this.inputAxisName = "Horizontal"; this.specialEffects.positiveTurnEffect = null; this.specialEffects.negativeTurnEffect = null; }
void HandleVerticalMovement(MovementSettings movementSettings) { //jumpy jumpy no fall yet if (Input.GetButton("Jump") && states.neutralStates != PlayerStates.NeutralStates.midair) { StartCoroutine(jump(movementSettings)); } }
public DashAbility(Player player, GameObject playerObj, MovementSettings movementSettings, float force, float cooldown, string inputName) : base("Dash", cooldown, inputName) { this.player = player; this.playerObj = playerObj; this.movementSettings = movementSettings; Force = force; }
public Ship(IView view, IGun gun, MovementSettings moveSettings) { Gun = gun; this.view = view; this.view.OnUpdate += OnUpdate; Projectile = new Projectile(view, moveSettings); Projectile.Type = ProjectileType.PlayerShip; }
private void SetupTest() { go = new GameObject(); player = go.AddComponent <PlayerCharacter>(); physics = go.AddComponent <PhysicsComponent>(); settings = go.AddComponent <MovementSettings>(); }
// instanciate the round settings public RoundSettings(MovementID _moveID = MovementID.walk, EnemyID _enemyID = EnemyID.none, CombatID _combatID = CombatID.none, TerrainID _terrainID = TerrainID.open) { moveID = _moveID; enemyID = _enemyID; combatID = _combatID; terrainID = _terrainID; moveInfo = MovementSettings.GetMovement(moveID); }
public static void InitializeAfterSceneLoad() { GameObject settingsGO = GameObject.Find("Settings"); PrefabHub = settingsGO.GetComponent <PrephabHub>(); MoveSettings = settingsGO.GetComponent <MovementSettings>(); DestroySettings = settingsGO.GetComponent <DestroySettings>(); CameraMoveSettings = settingsGO.GetComponent <CameraMovementSettings>(); DisableSystems(); }
public DefaultMovementEngine(IObjectManager objectManager, MovementSettings settings = null) { ObjectManager = objectManager; if (settings == null) { settings = new MovementSettings(); } Settings = settings; Reset(); }
public SmartMovementEngine(WowInterface wowInterface, MovementSettings movementSettings) { WowInterface = wowInterface; MovementSettings = movementSettings; Rnd = new Random(); CurrentPath = new Queue <Vector3>(); State = MovementEngineState.None; TryCount = 0; PlayerVehicle = new BasicVehicle(wowInterface, movementSettings.MaxSteering, movementSettings.MaxVelocity, movementSettings.MaxAcceleration); }
public SmartMovementEngine(GetPositionFunction getPositionFunction, GetRotationFunction getRotationFunction, MoveToPositionFunction moveToPositionFunction, GeneratePathFunction generatePathFunction, JumpFunction jumpFunction, ObjectManager objectManager, MovementSettings movementSettings) { State = MovementEngineState.None; GetPosition = getPositionFunction; GetRotation = getRotationFunction; MoveToPosition = moveToPositionFunction; GeneratePath = generatePathFunction; MovementSettings = movementSettings; ObjectManager = objectManager; Jump = jumpFunction; PlayerVehicle = new BasicVehicle(getPositionFunction, getRotationFunction, moveToPositionFunction, jumpFunction, objectManager, movementSettings.MaxSteering, movementSettings.MaxVelocity, movementSettings.MaxAcceleration); }
public Movable(MovementSettings settings) { this.settings = settings; var bottomLeft = Camera.main.ScreenToWorldPoint(Vector3.zero); var topRight = Camera.main.ScreenToWorldPoint(new Vector3( Camera.main.pixelWidth, Camera.main.pixelHeight)); screenspace = new Rect( bottomLeft.x, bottomLeft.y, topRight.x - bottomLeft.x, topRight.y - bottomLeft.y); }
protected override void SetupTest() { base.SetupTest(); player = Substitute.For <IPlayer>(); physics = go.AddComponent <PhysicsComponent>(); physics.Awake(); settings = go.AddComponent <MovementSettings>(); player.MovementSettings = settings; state.Inject(player, physics, settings); }
public void UnSubscribe() { if (isLocalPlayer) { PlayerObject playerObj = null; playerObj = GetComponent <PlayerObject>(); if (playerObj != null) { playerObj.UnRegisterHandler(ReceiveBroadcast); inputSettings = null; animatorSettings = null; movementSettings = null; } } }
private void Awake() { Assert.IsNotNull(prefabs, "No prefab game object given!"); movementSettings = new MovementSettings() .SetMaxSpeed(maxSpeed) .SetAcceleration(acceleration); bindings = new InputBindings() .SetHorizontal(horizontalBinding) .SetVertical(verticalBinding) .SetHook(hookBinding) .SetDash(dashBinding); strafeScheme = new StrafeMovement(Player, movementSettings, bindings); rotateScheme = new RotationalMovement(movementSettings, bindings); spawnPosition = transform.position; spawnRotation = transform.rotation; initialMaterials = transform.Find("NeoPlayer").GetComponent <MeshRenderer>().materials; respawnMaterials = new Material[initialMaterials.Length]; }
public AmeisenBot(string botDataPath, string accountName, AmeisenBotConfig config) { SetupLogging(botDataPath, accountName); AmeisenLogger.Instance.Log("AmeisenBot starting...", LogLevel.Master); string version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); AmeisenLogger.Instance.Log($"version: {version}", LogLevel.Master); Config = config; AccountName = accountName; AmeisenLogger.Instance.Log($"AccountName: {botDataPath}", LogLevel.Master); BotDataPath = botDataPath; AmeisenLogger.Instance.Log($"BotDataPath: {botDataPath}", LogLevel.Verbose); CurrentExecutionMs = 0; CurrentExecutionCount = 0; stateMachineTimerBusy = 0; StateMachineTimer = new Timer(config.StateMachineTickMs); StateMachineTimer.Elapsed += StateMachineTimerTick; OffsetList = new OffsetList335a(); AmeisenLogger.Instance.Log($"Using OffsetList: {OffsetList.GetType().ToString()}", LogLevel.Master); XMemory = new XMemory(); BotCache = new InMemoryBotCache(Path.Combine(BotDataPath, accountName, "cache.bin")); ObjectManager = new ObjectManager(XMemory, OffsetList, BotCache); HookManager = new HookManager(XMemory, OffsetList, ObjectManager, BotCache); CharacterManager = new CharacterManager(XMemory, config, OffsetList, ObjectManager, HookManager); EventHookManager = new EventHookManager(HookManager); PathfindingHandler = new NavmeshServerClient(Config.NavmeshServerIp, Config.NameshServerPort); MovementSettings = new MovementSettings(); MovemenEngine = new SmartMovementEngine( () => ObjectManager.Player.Position, () => ObjectManager.Player.Rotation, CharacterManager.MoveToPosition, (Vector3 start, Vector3 end) => PathfindingHandler.GetPath(ObjectManager.MapId, start, end), CharacterManager.Jump, ObjectManager, MovementSettings); if (!Directory.Exists(BotDataPath)) { Directory.CreateDirectory(BotDataPath); AmeisenLogger.Instance.Log($"Creating folder {botDataPath}", LogLevel.Verbose); } if (config.UseBuiltInCombatClass) { LoadDefaultCombatClass(); } else { LoadCustomCombatClass(); } if (CombatClass?.ItemComparator != null) { CharacterManager.ItemComparator = CombatClass.ItemComparator; } StateMachine = new AmeisenBotStateMachine(BotDataPath, WowProcess, Config, XMemory, OffsetList, ObjectManager, CharacterManager, HookManager, EventHookManager, BotCache, PathfindingHandler, MovemenEngine, CombatClass); StateMachine.OnStateMachineStateChanged += HandlePositionLoad; }
private void Awake() { mouseLook = new MouseLook(); movementSettings = new MovementSettings(); }
private void Start() { mvSettings = GameManager.MVSettings; jumpKey = player.KeysSettings.jumpKey; }
public Movement2D(MovementSettings settings) => _settings = settings ?? throw new ArgumentNullException(nameof(settings));
private const float TURN_SPEED = 90; // Degrees per second public RotationalMovement(MovementSettings settings, InputBindings bindings) : base(settings, bindings) { }
public float moved = 0f; // How far we moved public MovementAction(MovementSettings s, Transform t) { settings = s; transform = t; }
public MovementScheme(MovementSettings settings, InputBindings bindings) { this.settings = settings; this.bindings = bindings; }
public StrafeMovement(Player player, MovementSettings settings, InputBindings bindings) : base(settings, bindings) { this.player = player; allowedForMovement = new EnumBitField <Player.States>(Player.States.Hooking); }