Tuple <bool, int, int> amygdala_on_the_way(Move_Direction m) { if (player_movement_count != 0) { return(new Tuple <bool, int, int>(false, -1, -1)); } Tuple <int, int> modifier = get_player_position_modifiers(m); //Debug.Log(modifier); var px = (int)System.Math.Round(BuildLevel.docentInstance.transform.position.x); var py = (int)System.Math.Round(BuildLevel.docentInstance.transform.position.y); px += modifier.Item1; py += modifier.Item2; //WorldState.virt[px, py] = 166; //WorldState.debug_print_virtual_level(); byte at_location = WorldState.virt[px, py]; // Debug.Log("at_location = " + at_location); if (is_amygdala(at_location)) { return(new Tuple <bool, int, int>(true, px, py)); } return(new Tuple <bool, int, int>(false, -1, -1)); }
bool obstacles_on_the_way(Move_Direction m) { Tuple <int, int> modifier = get_player_position_modifiers(m); //Debug.Log(modifier); var px = (int)System.Math.Round(BuildLevel.docentInstance.transform.position.x); var py = (int)System.Math.Round(BuildLevel.docentInstance.transform.position.y); px += modifier.Item1; py += modifier.Item2; //WorldState.virt[px, py] = 166; //WorldState.debug_print_virtual_level(); byte at_location = WorldState.virt[px, py]; // Debug.Log("at_location = " + at_location); return(is_wall(at_location) || is_obstacle(at_location)); }
override protected void MoveChar(Move_Direction mvDir) { switch (mvDir) { case Move_Direction.UP: m_pos = new Vector2(m_pos.x, m_pos.y + 1); break; case Move_Direction.DOWN: m_pos = new Vector2(m_pos.x, m_pos.y - 1); break; case Move_Direction.LEFT: m_pos = new Vector2(m_pos.x - 1, m_pos.y); break; case Move_Direction.RIGHT: m_pos = new Vector2(m_pos.x + 1, m_pos.y); break; default: throw new System.Exception("Move direction was outside of the bounds of enumeration \"Move_Direction\""); } }
virtual protected void MoveChar(Move_Direction mvDir) { }
/********************************************************************************************************************************************************************************************************************** * Purpose: * Determines collision at the destination of the character and moves the player if there is none * * Precondition: * The character is told to move through their controller * * Postcondition: * The player is moved if there is no collision at the destination and stays still if there is collision ***********************************************************************************************************************************************************************************************************************/ virtual public void Move(Move_Direction mvDir) { MoveChar(mvDir); }
Tuple <int, int> get_player_position_modifiers(Move_Direction m) { return(moves_definition[m][WorldState.currentAngle]); }