예제 #1
0
파일: Game.cs 프로젝트: HImports/IslandGame
        private void handleLeftClickAsCharacterSelection(PlayerAction.Action action)
        {
            PlayerAction.LeftClick click = (PlayerAction.LeftClick)action;
            Ray ray = click.getRay();

            ray.Direction.Normalize();
            Vector3?blockVec = world.getBlockAlongRay(ray);

            if (blockVec.HasValue)
            {
                //world.addCharacterAt((Vector3)blockVec+new Vector3(0,1,0));
            }

            Character character  = world.getCharacterAlongRay(ray);
            bool      shouldJump = character != player.getSelectedCharacter();

            if (character == null)
            {
                player.deselectCharacter();
            }
            else
            {
                player.characterWasLeftClicked(character);
            }
            if (character != null && shouldJump)
            {
                //character.jump();
            }
        }