public bool Equals(tile_position a) { if (( object )a == null) { return(false); } return((this.x == a.x) && (this.y == a.y)); }
public void handle_input() { if (Input.GetMouseButtonDown(0)) { this.selection_start_position = this.lm.get_mouse_position_ts(); } else if (Input.GetMouseButtonUp(0)) { List <tile_position> altered = new List <tile_position>(); var mp = this.lm.get_mouse_position_ts(); if (this.selection_start_position == mp) { altered.Add(this.selection_start_position); } else { var a = this.selection_start_position; var b = mp; int min_x = Mathf.Min(a.x, b.x); int max_x = Mathf.Max(a.x, b.x); int min_y = Mathf.Min(a.y, b.y); int max_y = Mathf.Max(a.y, b.y); for (int x = min_x; x <= max_x; x++) { for (int y = min_y; y <= max_y; y++) { if (0 <= x && x < this.lm.map_width && 0 <= y && y < this.lm.map_height) { altered.Add(new tile_position(x, y)); } } } } if (Input.GetKey(KeyCode.LeftShift)) { this.add_selected(altered); } else if (Input.GetKey(KeyCode.LeftAlt)) { this.remove_selected(altered); } else { this.clear_selected(); this.add_selected(altered); } } }
void hard_set_position(tile_position _position) { this._position = _position; var position = this._map.get_ms_position_ts(_position); this.transform.position = position; this.transition_position_start = position; this.transition_position_halfway = position; this.transitioning_direction = direction.none; this.transition_time_current = 0.0f; this.current_tile = this._map.get_tile(this._position); }
public override bool Equals(System.Object obj) { if (obj == null) { return(false); } tile_position a = obj as tile_position; if ((System.Object)a == null) { return(false); } return((this.x == a.x) && (this.y == a.y)); }
public void travel_relative(direction _direction) { if (_direction != direction.none) { tile_position position = this._position + tile_position.offset(_direction); if (this._map.is_traversible_ts(position)) { this._position = position; // Update the current tile and ensure clean up of previous by grabbing the out time and calling on_exit. this.transition_time_out = this.current_tile.description.transition_time; this.current_tile.on_exit(); this.current_tile = this._map.get_tile(this._position); // Store the value for time in and calculate the time out value. this.transition_time_in = this.current_tile.description.transition_time; this.transition_time_total = this.transition_time_in + this.transition_time_out; // Update the sprite renderer to have the sprite of the current facing direction this._sr.sprite = sprite_manager.instance.player_direction(_direction); // Set transitioning to true and ensure timer is zero'd. this.transitioning = true; this.transitioning_direction = _direction; this.transition_time_current = 0.0f; // Calculate the delta between positions, storing half delta. var delta = this._map.get_ms_position_ts(this._position) - this.transform.position; this.transition_delta_half = delta / 2.0f; // Store the start position and the halfway position for transition effect. this.transition_position_start = this.transform.position; this.transition_position_halfway = this.transition_position_start + this.transition_delta_half; } } }
public tile_object get_tile(tile_position position) { return(this.get_tile(position.x, position.y)); }
public Vector3 get_ms_position_ts(tile_position position) { return(this.get_ms_position_ts(position.x, position.y)); }
public bool is_traversible_ts(tile_position position) { return(this.is_traversible_ts(position.x, position.y)); }
public bool on_map_ts(tile_position position) { return(this.on_map_ts(position.x, position.y)); }